A. Red Versus Blue

time limit per test

1 second

memory limit per test

256 megabytes

Team Red and Team Blue competed in a competitive FPS. Their match was streamed around the world. They played a series of n matches.

In the end, it turned out Team Red won r times and Team Blue won b times. Team Blue was less skilled than Team Red, so b was strictly less than r.

You missed the stream since you overslept, but you think that the match must have been neck and neck since so many people watched it. So you imagine a string of length n where the i-th character denotes who won the i-th match --- it is R if Team Red won or B if Team Blue won. You imagine the string was such that the maximum number of times a team won in a row was as small as possible. For example, in the series of matches RBBRRRB, Team Red won 3 times in a row, which is the maximum.

You must find a string satisfying the above conditions. If there are multiple answers, print any.

Input

The first line contains a single integer t (1≤t≤1000) --- the number of test cases.

Each test case has a single line containing three integers n, r, and b (3≤n≤100; 1≤b<r≤n, r+b=n).

Output

For each test case, output a single line containing a string satisfying the given conditions. If there are multiple answers, print any.

Examples

Input

Copy

复制代码

3

7 4 3

6 5 1

19 13 6

Output

Copy

复制代码
RBRBRBR
RRRBRR
RRBRRBRRBRRBRRBRRBR

Input

Copy

复制代码

6

3 2 1

10 6 4

11 6 5

10 9 1

10 8 2

11 9 2

Output

Copy

复制代码
RBR
RRBRBRBRBR
RBRBRBRBRBR
RRRRRBRRRR
RRRBRRRBRR
RRRBRRRBRRR

Note

The first test case of the first example gives the optimal answer for the example in the statement. The maximum number of times a team wins in a row in RBRBRBR is 1. We cannot minimize it any further.

The answer for the second test case of the second example is RRBRBRBRBR. The maximum number of times a team wins in a row is 2, given by RR at the beginning. We cannot minimize the answer any further.

解题说明:此题是一道模拟题,为了确保连续R出现的次数最少,需要尽可能将R和B平均分配到队列中。首先统计出R和B的比例情况,然后按照比例输出R和B。

cpp 复制代码
#include<stdio.h>
int main()
{
    int t, i, n, r, b;
    scanf("%d", &t);
    for (i = 0; i < t; i++) 
    {
        scanf("%d %d %d", &n, &r, &b);
        char win[101];
        int k = 0;
        while (r > 0) 
        {
            int z = r / (b + 1);
            for (int j = 0; j < z; j++)
            {
                win[k] = 'R';
                k++;
            }
            if (b > 0) 
            {
                win[k] = 'B';
                k++;
            }
            r = r - z;
            b = b - 1;
        }
        win[n] = '\0';
        printf("%s\n", win);
    }
    return 0;
}
相关推荐
AI小老六3 小时前
SkillOpt 架构拆解:把 Skill 文本当参数,用执行轨迹训练 Agent
后端·算法·ai编程
胡萝卜术4 小时前
从“分数打架”到“排名投票”:为什么你的ChatBI必须用RRF?
算法·设计模式·面试
Asize4 小时前
初识DFS 与 BFS:递归、队列与图遍历
算法
罗西的思考18 小时前
机器人 / 强化学习】HIL-SERL:人类在环驱动的具身智能进化框架
人工智能·算法·机器学习
美团技术团队21 小时前
LongCat 开源 VitaBench 2.0:长期动态智能体基准新标杆
人工智能·算法
To_OC2 天前
LC 207 课程表:刚学图论那会儿,我连这是拓扑排序都没看出来
javascript·算法·leetcode
To_OC2 天前
LC 208 实现 Trie 前缀树:曾被名字劝退,写完发现是送分题
javascript·算法·leetcode
BadBadBad__AK2 天前
线段树维护区间 k 次方和
c++·数学·算法·stl
_清歌2 天前
DSpark 深度解读:DeepSeek-V4 如何用「半自回归」把推理速度提升 85%
算法