QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#17949. 삼각 초콜릿 포장 (Bitter)

統計

코코네 초콜릿 가게에서는 밸런타인 특별 상품으로 정육각형 3개를 삼각형 모양으로 붙인 초콜릿을 판매하려고 한다. 코코는 같은 크기의 정육각형 $\frac{N(N+1)}{2}$개를 삼각형 모양으로 붙인 형태의 틀에 이 초콜릿들을 빈틈없이 넣어 포장하려고 한다. 그리고 이를 조금 더 예뻐 보이게 하기 위해, 위로 뾰족한 방향으로 배치된 초콜릿은 빨간색, 반대 방향의 초콜릿은 파란색으로 개별 포장을 하기로 했다. 포장이 완료된 상품은 겉에서 볼 때 각각의 육각형이 빨간색인지 파란색인지만 알 수 있고, 어느 칸들이 같은 조각인지는 알 수 없다.

수학 고수인 코코는 $N$을 $12$로 나눈 나머지가 $0$, $2$, $9$, $11$일 때에만 틀을 초콜릿으로 채울 수 있음을 증명했지만, 실제로 초콜릿을 어떻게 배치할지 고민하고 있다. 코코를 도와 초콜릿을 포장해 주자.

Input

첫 번째 줄에 삼각형 틀의 한 변의 길이 $N$이 주어진다. $(2 \le N \le 5\,001)$ $N$을 $12$로 나눈 나머지는 $0$, $2$, $9$, $11$ 중 하나이다.

Output

$N$줄에 걸쳐서 빨간색과 파란색 육각형의 배치를 공백 없이 출력한다. 빨간색은 R, 파란색은 B로 나타내며, $i$번째 줄에는 그 줄에 속하는 $i$개의 육각형에 해당하는 글자를 왼쪽부터 순서대로 출력한다. ($1 \le i \le N$)

Examples

Input 1

2

Output 1

R
RR

Input 2

9

Output 2

R
RR
RBB
RRBR
RBBRR
RRBBBR
BBBBBRR
RBRBRBBR
RRRRRRBRR

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.