問題一覧 > 通常問題

No.2671 NUPC Decompressor

レベル : / AI推定難易度 : 167 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 164
作問者 : eoeo / テスター : Xelmeph nu50218 null ngtkana NokonoKotlin
お気に入りにしたユーザー ProblemId : 10411 / 自分の提出
問題文最終更新日: 2024-03-15 21:21:35
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 421 (NUPC2023) (順位表) の他の問題:

Problem Statement

A string $S = S_1 S_2 \cdots S_8$ of length $8$ is called an NUPC compressed string if it satisfies both of the following conditions.

  • The odd-positioned characters $S_1, S_3, S_5, S_7$ are N, U, P, C, respectively, in this order.
  • The even-positioned characters $S_2, S_4, S_6, S_8$ are each 1 or 2.

As the name suggests, an NUPC compressed string $S$ is a compressed form of some string. The original string $T$ before compression is obtained by decompressing $S$ with the following procedure.

  1. Let $T$ be a string of length $0$.
  2. For $i = 1, 2, \dots, 8$ in order, perform the following operation.
    • If $i$ is odd, append $S_i$ to the end of $T$.
    • If $i$ is even,
      • If $S_i$ is 1, do nothing.
      • If $S_i$ is 2, replace $T$ with "the string obtained by concatenating $T$ and $T$".

There are $16$ NUPC compressed strings in total. Given an integer $1 \leq K \leq 16$, output the $K$-th smallest string in lexicographical order among all strings obtained by decompressing NUPC compressed strings.

Input

The input is given from standard input in the following format.

$K$

Output

Output the answer to standard output on a single line, followed by a newline.

Constraints

The input satisfies the following constraints.

  • $K$ is an integer satisfying $1 \leq K \leq 16$.

Sample

Sample 1
Input
1
Output
NNUNNUPC

The lexicographically 1st smallest string is NNUNNUPC. It is obtained by decompressing the NUPC compressed string N2U2P1C1.

When decompressing the string N2U2P1C1, the value of $T$ after performing the operation for each $i = 1, 2, \dots, 8$ in the decompression procedure is as follows.

  1. N
  2. NN
  3. NNU
  4. NNUNNU
  5. NNUNNUP
  6. NNUNNUP
  7. NNUNNUPC
  8. NNUNNUPC
Sample 2
Input
5
Output
NNUPC

This is the string obtained by decompressing the NUPC compressed string N2U1P1C1.

Sample 3
Input
13
Output
NUPC

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。