結果
問題 |
No.153 石の山
|
ユーザー |
![]() |
提出日時 | 2020-03-05 10:07:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-14 00:49:23 |
合計ジャッジ時間 | 2,267 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% N = int(read()) # %% dp = [0] * 101 dp[2] = 1 for n in range(3, 101): G = [] q, r = divmod(n, 2) if r == 0: G.append(0) else: G.append(dp[q] ^ dp[q + 1]) q, r = divmod(n, 3) if r == 0: G.append(dp[q]) elif r == 1: G.append(dp[q + 1]) else: G.append(dp[q]) g = 0 while True: if g in G: g += 1 continue dp[n] = g break # %% answer = 'A' if dp[N] else 'B' print(answer)