Codeforces Round 800 (Div. 2)
A
Creep
Codeforces
800
原题
←B →
翻译中…

Define the score of some binary string $T$ as the absolute difference between the number of zeroes and ones in it. (for example, $T=$ 010001 contains $4$ zeroes and $2$ ones, so the score of $T$ is $|4-2| = 2$).

翻译中…

Define the creepiness of some binary string $S$ as the maximum score among all of its prefixes (for example, the creepiness of $S=$ 01001 is equal to $2$ because the score of the prefix $S[1 \ldots 4]$ is $2$ and the rest of the prefixes have a score of $2$ or less).

翻译中…

Given two integers $a$ and $b$, construct a binary string consisting of $a$ zeroes and $b$ ones with the minimum possible creepiness.

翻译中…

Input

翻译中…

The first line contains a single integer $t$ $(1\le t\le 1000)$  — the number of test cases. The description of the test cases follows.

翻译中…

The only line of each test case contains two integers $a$ and $b$ ($ 1 \le a, b \le 100$)  — the numbers of zeroes and ones correspondingly.

翻译中…

Output

翻译中…

For each test case, print a binary string consisting of $a$ zeroes and $b$ ones with the minimum possible creepiness. If there are multiple answers, print any of them.

翻译中…

Note

翻译中…

In the first test case, the score of $S[1 \ldots 1]$ is $1$, and the score of $S[1 \ldots 2]$ is $0$.

翻译中…

In the second test case, the minimum possible creepiness is $1$ and one of the other answers is 101.

翻译中…

In the third test case, the minimum possible creepiness is $3$ and one of the other answers is 0001100.

翻译中…

样例

Input #1
5
1 1
1 2
5 2
4 5
3 7
Output #1
10
011
0011000
101010101
0001111111
InputCopy OutputCopy
题目信息
题号
1694A
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。