結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
|
提出日時 | 2024-05-31 21:42:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 291 bytes |
コンパイル時間 | 228 ms |
コンパイル使用メモリ | 82,064 KB |
実行使用メモリ | 55,508 KB |
最終ジャッジ日時 | 2024-12-20 22:57:29 |
合計ジャッジ時間 | 3,109 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 31 |
ソースコード
from collections import dequeN=int(input())if N==1:exit(print())Q=deque()Q.append((N,""))while Q:N,ans=Q.popleft()if N==1:breakif (N-1)%2==0:Q.append(((N-1)//2,ans+"A"))if (N-1)%3==0:Q.append(((N-1)//3,ans+"B"))print("".join(list(reversed(ans))))