結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
|
提出日時 | 2024-05-31 21:31:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 309 bytes |
コンパイル時間 | 310 ms |
コンパイル使用メモリ | 82,124 KB |
実行使用メモリ | 53,456 KB |
最終ジャッジ日時 | 2024-12-20 22:31:47 |
合計ジャッジ時間 | 3,086 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 31 |
ソースコード
import sys sys.setrecursionlimit(10**8) n=int(input()) S=set() ans=[] def f(x): global S,ans if x==1: print("".join(ans)[::-1]) exit() if x not in S: S.add(x) if (x-1)%2==0: ans.append("A") f((x-1)//2) ans.pop() if (x-1)%3==0: ans.append("B") f((x-1)//3) ans.pop() f(n)