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;
}
相关推荐
꧁细听勿语情꧂2 小时前
向下调整算法,top - k 问题,链式结构二叉树,前中后序遍历
c语言·开发语言·数据结构·算法
水蓝烟雨2 小时前
3487. 删除后的最大子数组元素和
算法·leetcode·链表
LG.YDX2 小时前
笔试训练48天:最长无重复子数组
数据结构·算法
yong99903 小时前
基于灰狼算法优化支持向量回归(GWO-SVR)的混合算法
算法·数据挖掘·回归
sali-tec3 小时前
C# 基于OpenCv的视觉工作流-章53-QR二维码1
图像处理·人工智能·opencv·算法·计算机视觉
ECT-OS-JiuHuaShan3 小时前
功夫不负匠心人,渡劫代谢舞沧桑
android·开发语言·人工智能·算法·机器学习·kotlin·拓扑学
智者知已应修善业3 小时前
【51单片机ADC-MAX1241/ADC0832驱动】2023-6-6
c++·经验分享·笔记·算法·51单片机
re林檎3 小时前
算法札记——4.26
算法
tankeven3 小时前
动态规划专题(10):最优三角剖分问题
c++·算法·动态规划