cswork / OA打开练习工作台

IBMOA #26

Find Y Value

估计简单可在线判题

考点(AI 标注)位运算贪心调度

Given a fixed-length binary string x, construct a binary string y of the same length containing at most maxSet 1s so that the unsigned value of x XOR y is maximized. Output y; leading 0s are allowed.

输入格式

The first line contains bits maxSet, and the second line contains x. On this site 1≤bits≤100000, 0≤maxSet≤bits.

输出格式

Output the binary string y of the same length.

样例 1

输入:

4 2
1001

输出:

0110

样例 2

输入:

3 3
111

输出:

000

样例 3

输入:

4 1
0000

输出:

1000

样例说明

The examples give 0110, 000 and 1000 respectively.