結果

問題 No.153 石の山
ユーザー PNJPNJ
提出日時 2023-11-06 05:57:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 311 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-25 22:59:01
合計ジャッジ時間 2,123 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
G = [0,0,1,2,2]
for x in range(5,N+1):
  S = set()
  if x % 2 == 0:
    g = 0
  else:
    g = G[x//2] ^ G[x//2 + 1]
  S.add(g)
  if x % 3 == 1:
    g = G[x//3 + 1]
  else:
    g = G[x//3]
  S.add(g)
  g = 0
  while g in S:
    g += 1
  G.append(g)
ans = 'A'
if G[N] == 0:
  ans = 'B'
print(ans)
0