CF1694A.Creep

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

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

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

定义某个二进制字符串 TT 的得分为其中 0 的个数与 1 的个数之差的绝对值。(例如,T=T = 010001 包含 4 个 0 和 2 个 1,因此 TT 的得分为 ∣4−2∣=2|4-2| = 2。)

定义某个二进制字符串 SS 的诡异度(creepiness) 为 SS 的所有前缀中得分的最大值。(例如,S=S = 01001 的诡异度等于 22,因为其前缀 S[1…4]S[1 \ldots 4] 的得分为 22,而其余所有前缀的得分均不超过 22。)

给定两个整数 aa 和 bb,请构造一个恰好包含 aa 个 0 和 bb 个 1 的二进制字符串,使其诡异度尽可能小。

输入格式

The first line contains a single integer tt (1≤t≤1000)(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 aa and bb ($ 1 \le a, b \le 100$) — the numbers of zeroes and ones correspondingly.

第一行包含一个整数 tt(1≤t≤10001\le t\le 1000)—— 表示测试用例的数量。随后是各测试用例的描述。

每个测试用例仅有一行,包含两个整数 aa 和 bb(1≤a,b≤1001 \le a, b \le 100)—— 分别表示零的个数和一的个数。

输出格式

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

对于每个测试用例,输出一个由 aa 个 0 和 bb 个 1 组成的二进制字符串,使其“蠕变度”(creepiness)最小。如果存在多个满足条件的答案,输出任意一个即可。

输入输出样例

  • 输入#1

    5
    1 1
    1 2
    5 2
    4 5
    3 7

    输出#1

    10
    011
    0011000
    101010101
    0001111111

说明/提示

In the first test case, the score of S[1…1]S[1 \ldots 1] is 11, and the score of S[1…2]S[1 \ldots 2] is 00.

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

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

在第一个测试用例中,子串 S[1…1]S[1 \ldots 1] 的得分为 11,子串 S[1…2]S[1 \ldots 2] 的得分为 00。

在第二个测试用例中,最小可能的“creepiness”值为 11,另一个合法答案为 101。

在第三个测试用例中,最小可能的“creepiness”值为 33,另一个合法答案为 0001100。

输入解题思路,AI测评打分。不知道怎么写?

首页