/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
高橋君は横一列に N 個のマスが並んだ布を、縞模様に染めます。
左から順に、最初の K マスを赤、次の K マスを青、次の K マスを赤、…と、 K マスごとに赤と青を交互に染めていきます。 N が K の倍数でない場合、最後の縞は K マスより短くなります。
染め終わった布の様子を、左から順に、赤いマスを R 、青いマスを B で表した長さ N の文字列として出力してください。
制約
- 1 \leq N \leq 100
- 1 \leq K \leq 100
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N K
- 1 行目には、マスの数 N と縞の幅 K がスペース区切りで与えられる。
出力
染め終わった布の様子を表す長さ N の文字列を 1 行で出力せよ。
入力例 1
6 2
出力例 1
RRBBRR
入力例 2
6 3
出力例 2
RRRBBB
入力例 3
4 1
出力例 3
RBRB
入力例 4
99 1
出力例 4
RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBR
入力例 5
6 1
出力例 5
RBRBRB
Score : 200 pts
Problem Statement
Takahashi is dyeing a cloth consisting of N cells arranged in a horizontal row in a striped pattern.
From left to right, he paints the first K cells red, the next K cells blue, the next K cells red, and so on, alternating between red and blue every K cells. If N is not a multiple of K, the last stripe will be shorter than K cells.
Print the resulting cloth as a string of length N, from left to right, using R for red cells and B for blue cells.
Constraints
- 1 \leq N \leq 100
- 1 \leq K \leq 100
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N K
- The first line contains the number of cells N and the stripe width K, separated by a space.
Output
Print one line containing the string of length N representing the dyed cloth.
Sample Input 1
6 2
Sample Output 1
RRBBRR
Sample Input 2
6 3
Sample Output 2
RRRBBB
Sample Input 3
4 1
Sample Output 3
RBRB
Sample Input 4
99 1
Sample Output 4
RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBR
Sample Input 5
6 1
Sample Output 5
RBRBRB