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;
}
相关推荐
不会就选b7 分钟前
算法日常・每日刷题--<快排>4
算法
Keven_1113 分钟前
算法札记:树状数组的用途
数据结构·算法
用户6774371758120 分钟前
C++函数参数传递方式详解:string、string&、const string、const string&该怎么选?
算法
cpp_25011 小时前
P1540 [NOIP 2010 提高组] 机器翻译
数据结构·c++·算法·队列·noip·洛谷题解
晚笙coding1 小时前
LeetCode 98:验证二叉搜索树 —— 从局部判断到全局范围约束的递归思想
算法·leetcode·职场和发展
学计算机的计算基1 小时前
回溯算法下篇:四道经典题讲透约束剪枝、原地标记、预计算与状态压缩
java·笔记·算法
霸道流氓气质1 小时前
SpringBoot中实现告警判定算法-位报警与模拟量阈值-技术详解
spring boot·算法·jquery
行者全栈架构师2 小时前
混元 Hy3 Agent 实战:季度报告 3 小时变 40 分钟
算法·架构·代码规范
兰令水2 小时前
hot100【acm版】【2026.7.21打卡-java版本】
java·开发语言·算法·leetcode·面试
好好沉淀2 小时前
主键选择(自增 vs UUID vs 雪花算法)
java·算法