No.3135 AAABC
問題文最終更新日: 2025-04-26 14:56:42
English (AI translation)
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 466 オムニバスコンテスト
(順位表)
の他の問題:
Problem Statement
Consider strings of length $N$ consisting only of A, B, C, in which each of the characters is used at least once.
Among all such strings, output the $S$-th one in lexicographically increasing order.
If there is no such string, output -1.
Input
$N$ $S$
$3 \le N \le 12$
$1 \le S \le 10^6$
All inputs are given as integers.
Output
Output the answer to standard output in $1$ line.
Sample
Sample 1
Input
5
1
Output
AAABC
Sample 2
Input
3
6
Output
CBA
Sample 3
Input
5
151
Output
-1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。