結果

問題 No.153 石の山
ユーザー satama6satama6
提出日時 2022-10-19 02:18:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 71,472 KB
最終ジャッジ日時 2023-09-11 17:41:10
合計ジャッジ時間 4,657 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,168 KB
testcase_01 AC 70 ms
71,224 KB
testcase_02 WA -
testcase_03 AC 72 ms
71,280 KB
testcase_04 AC 71 ms
71,052 KB
testcase_05 AC 69 ms
71,256 KB
testcase_06 AC 68 ms
71,136 KB
testcase_07 AC 68 ms
71,344 KB
testcase_08 WA -
testcase_09 AC 68 ms
71,176 KB
testcase_10 WA -
testcase_11 AC 68 ms
71,212 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 69 ms
71,232 KB
testcase_16 AC 70 ms
71,260 KB
testcase_17 AC 70 ms
71,188 KB
testcase_18 AC 70 ms
71,260 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 71 ms
71,348 KB
testcase_22 AC 72 ms
71,172 KB
testcase_23 AC 70 ms
71,168 KB
testcase_24 AC 68 ms
71,108 KB
testcase_25 AC 69 ms
71,052 KB
testcase_26 AC 69 ms
71,280 KB
testcase_27 WA -
testcase_28 AC 69 ms
71,128 KB
testcase_29 WA -
testcase_30 AC 69 ms
71,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

grundy = [0] * (101)
grundy[2] = 1

for i in range(3, N+1):
    tmp = set()
    if i & 1:
        tmp.add(grundy[i//2] ^ grundy[i//2 + 1])
    else:
        tmp.add(0)
    
    if i % 3 == 0:
        tmp.add(grundy[i//3])
    elif i % 3 == 1:
        tmp.add(grundy[i//3 + 1])
    else:
        tmp.add(grundy[i//3] ^ grundy[i//3 + 1] ^ grundy[i//3 + 2])
    
    g = 0
    while g in tmp:
        g += 1
    grundy[i] = g


if grundy[N] == 0:
    print('B')
else:
    print('A')
0