結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
|
提出日時 | 2024-05-31 21:33:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 604 bytes |
コンパイル時間 | 395 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 57,340 KB |
最終ジャッジ日時 | 2024-12-20 22:38:02 |
合計ジャッジ時間 | 3,610 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 31 |
ソースコード
import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 def f(x, S): if x == 1: return S if (x - 1) // 2 >= 1 and (x - 1) % 2 == 0: p = f((x - 1) // 2, S + 'A') if p is not None: return p if (x - 1) // 3 >= 1 and (x - 1) % 3 == 0: p = f((x - 1) // 3, S + 'B') if p is not None: return p return None print(f(ii(), '')[::-1])