#P12353. 「HCOI-R2」DataErr0r
「HCOI-R2」DataErr0r
Description
For two binary strings , (consisting of and ) of length and length . You can perform the following types of operations:
-
Remove any bit from .
-
Choose . For every satisfying and , let .
You need to find the minimum number of operations to make .
Input Format
Each test consists of multiple test cases. The first line contains a single integer --- the number of sets of test cases. The description of test cases follows.
The first line of each test case contains a single integer --- the length of .
The second line contains a single string with size .
The third line contains a single string with size .
It is guaranteed that the sum of does not exceed .
Output Format
For each test case, output a single number, containing the answer to how many operations are needed at least to make all digits the same for and .
1
4
10101
1111
2
3
1
11
1
3
1010
010
7
10110110
0001111
1
1
2
Hint
For the first sample, we can do operations below:
So we need operations.
Constraints
This problem uses subtasks.
- Subtask 0 (15 pts): .
- Subtask 1 (35 pts): .
- Subtask 2 (50 pts): No additional constraints.
It is guaranteed that , , .
京公网安备 11011102002149号