結果
| 問題 |
No.153 石の山
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-29 13:58:09 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 322 bytes |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2024-11-21 10:27:46 |
| 合計ジャッジ時間 | 1,476 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 20 WA * 7 |
ソースコード
N = input()
if N == 1:
print 'B'
exit()
grundy = [0 for _ in xrange(N+1)]
grundy[2] = 1
for i in xrange(3, N+1):
m1 = grundy[i/3] ^ grundy[i/3+(i%3==1)] ^ grundy[i/3+(i%3==2)]
m2 = grundy[i/2] ^ grundy[i/2+(i%2==1)]
while grundy[i] in (m1, m2):
grundy[i] += 1
print 'A' if grundy[N] else 'B'