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;
}
相关推荐
海梨花10 分钟前
字节面试高频算法题
java·算法·面试·职场和发展
aqiu11111116 分钟前
python02
算法
瓦特what?17 分钟前
位运算核心技巧与应用
java·jvm·算法
无限码力17 分钟前
阿里算法岗 0530笔试真题 - 荆棘林的最优砍断计划
算法·阿里笔试真题·阿里机试真题·阿里算法岗笔试真题·阿里巴巴笔试真题
随意起个昵称20 分钟前
线性dp-LIS题目5(导弹拦截,二分优化)
c++·算法·动态规划
winlife_20 分钟前
全程用 AI 做一款商业级手游 · EP10 道具系统:让三个按钮真正改变棋盘
windows·算法·unity·ai编程·游戏开发·mcp·玩法系统
计算机安禾24 分钟前
【数据库系统原理】第16篇:范式理论(下):多值依赖与第四范式——消除非平凡的非函数依赖
算法
lqqjuly29 分钟前
一致性模型深度解析
人工智能·深度学习·算法
RisunJan30 分钟前
Linux命令-patch (为开放源代码软件安装补丁程序)
linux·服务器·算法
一条大祥脚1 小时前
ABC460贪心|多源BFS|数论|计数|线段树|树的直径
算法·宽度优先