結果

問題 No.3135 AAABC
ユーザー 👑 loop0919
提出日時 2025-05-02 21:47:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 447 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 129,944 KB
最終ジャッジ日時 2025-05-02 21:47:51
合計ジャッジ時間 4,127 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product

N = int(input())
S = int(input())

li = []

for s in product(["A", "B", "C"], repeat=N):
    if not set(s) == {"A", "B", "C"}:
        continue
    s = "".join(s)
    li.append(s)
    
    if len(li) >= S:
        break

print(li[S-1] if len(li) >= S else -1)
0