AtCoder Grand Contest 072
翻译中…
Problem Statement
翻译中…
AtCoder City is represented by an $N \times N$ grid. Let $(i, j)$ denote the cell at the $i$‑th row from the top $(1 \le i \le N)$ and the $j$‑th column from the left $(1 \le j \le N)$.
翻译中…
Aoki performed the following exercise $K$ times for marathon training.
翻译中…
- Start from cell
$(1, 1)$. - Repeat the following action
$2N-2$times to reach cell$(N, N)$:
- Move one cell down or right. If both moves are possible, choose the one whose destination cell has been visited fewer times in the previous exercises. If the counts are equal, choose the downward move.
翻译中…
Print the path taken in the $K$‑th exercise.
翻译中…
Constraints
翻译中…
$2 \le N \le 100$$1 \le K \le 10^{18}$- All input values are integers.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N K
翻译中…
Output
翻译中…
Print a string of length $2N-2$. The $i$‑th character should be D if the $i$‑th move in the $K$‑th exercise goes downward, and R if it goes rightward.
翻译中…
样例
Input #1
5 4
Output #1
RRDDRRDD
The 1st, 2nd, 3rd, and 4th exercises go as follows, so the answer is `RRDDRRDD`.

Input #2
10 869120
Output #2
RDRRRDRDRDRDRDDDRD
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。