結果
問題 |
No.153 石の山
|
ユーザー |
![]() |
提出日時 | 2023-07-12 12:04:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 47 ms / 5,000 ms |
コード長 | 397 bytes |
コンパイル時間 | 217 ms |
コンパイル使用メモリ | 82,372 KB |
実行使用メモリ | 56,992 KB |
最終ジャッジ日時 | 2024-09-14 02:01:12 |
合計ジャッジ時間 | 2,693 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
import sys sys.setrecursionlimit(10**7) from functools import lru_cache @lru_cache(maxsize=None) def f(n): if n == 1: return 0 S = set() S.add(f(n//2)^f((n+1)//2)) if n >= 3: S.add(f(n//3)^f((n+1)//3)^f((n+2)//3)) now = 0 while True: if now not in S: return now now += 1 N = int(input()) print("A") if f(N) else print("B")