CF2118A.Equal Subsequences

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Equal Subsequences

We call a bitstring^{\text{∗}} perfect if it has the same number of 101 and 010 subsequences^{\text{†}}. Construct a perfect bitstring of length nn where the number of 1 characters it contains is exactly kk.

It can be proven that the construction is always possible. If there are multiple solutions, output any of them.

^{\text{∗}}A bitstring is a string consisting only of the characters 0 and 1.

^{\text{†}}A sequence aa is a subsequence of a string bb if aa can be obtained from bb by the deletion of several (possibly zero or all) characters.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t5001 \le t \le 500). The description of the test cases follows.

The first line of each test case contains two integers nn and kk (1n1001 \le n \le 100, 0kn0 \le k \le n) — the size of the bitstring and the number of 1 characters in the bitstring.

Output

For each test case, output the constructed bitstring. If there are multiple solutions, output any of them.

Note

In the first test case, the number of 101 and 010 subsequences is the same, both being 11, and the sequence contains exactly two 1 characters.

In the second test case, the number of 101 and 010 subsequences is the same, both being 22, and the sequence contains exactly three 1 characters.

In the third test case, the number of 101 and 010 subsequences is the same, both being 00, and the sequence contains exactly five 1 characters.

Samples

5
4 2
5 3
5 5
6 2
1 1
1010
10110
11111
100010
1

在线编程 IDE

建议全屏模式获得最佳体验