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;
}
相关推荐
SilentSamsara6 分钟前
自定义上下文管理器实战:数据库连接池、文件锁与超时控制
开发语言·python·算法·青少年编程
吃着火锅x唱着歌14 分钟前
LeetCode 503.下一个更大元素II
算法·leetcode·职场和发展
_深海凉_18 分钟前
LeetCode热题100-将有序数组转换为二叉搜索树
数据结构·算法·leetcode
KaMeidebaby27 分钟前
卡梅德生物技术快报|单克隆抗体人源化 PEG 修饰质控方法体系构建与验证
服务器·前端·数据库·人工智能·算法·百度·新浪微博
不知名的老吴42 分钟前
二叉树的遍历算法之先序遍历
算法
liu****44 分钟前
第16届国赛蓝桥杯大赛C/C++大学B组
c语言·数据结构·c++·算法·蓝桥杯
SimpleLearingAI1 小时前
大模型推理框架总结解析
算法
Σίσυφος19001 小时前
正则化数据并校准数据
人工智能·算法·机器学习
HZ·湘怡1 小时前
基于动态数组的栈(顺序栈)01
数据结构·算法
Chen_harmony1 小时前
十八、C语言内存函数
c语言·算法