#P9805. Binary Number
Binary Number
Binary Number
Problem Description
Markyyz is learning binary numbers. There is an easy problem in his homework. You are given a binary number ( is the highest bit. is the lowest bit.). You need to do an operation exactly times: select an interval arbitrarily and flip , in other word, for all , becomes if is , becomes if is . What is the biggest result binary number after the operations. Markyyz found useless algorithms useless on the problem, so he asked SPY for help. SPY looked down on the problem but finally got WA (wrong answer). Can you help them to find the right solution?
Input
The first line of the input contains a single integer , indicating the number of test cases. In each test case: The first line contains two integers . The second line contains a binary number . , It's guarenteed that in all test cases,
Output
You need to print a string of length in one line, representing the biggest binary number after the operations.
Sample Input
2
8 2
10100101
5 233333333333333333
11101
Sample Output
11111101
11111
Source
2023“钉耙编程”中国大学生算法设计超级联赛(2)