[Solution] Copy and Paste CodeChef Solution
Problem
Chef has binary string of length . He constructs a new binary string by concatenating copies of together. For example, if , , then .
Chef calls an index good if:
- .
Here, and (Note that by definition)
Chef wants to find the number of good indices in . Can you help him do so?
Input Format
- The first line contains a single integer — the number of test cases. Then the test cases follow.
👇👇👇👇👇
- The first line of each test case contains two space-separated integers and — the length of the binary string and the number of times is concatenated to form $
- The second line of each test case contains a binary string of length containing s and s only.
Output Format
For each test case, output the number of good indices in .
Explanation:
Test case : . In this string, all the indices are good.
Test case : . In this string, only is good.
Test case : . In this string, and are good.
No comments:
Post a Comment