結果

問題 No.153 石の山
ユーザー mbanmban
提出日時 2017-07-26 02:29:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 397 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 54,096 KB
最終ジャッジ日時 2024-04-17 23:42:35
合計ジャッジ時間 2,155 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,768 KB
testcase_01 AC 40 ms
54,012 KB
testcase_02 AC 39 ms
53,220 KB
testcase_03 AC 39 ms
52,604 KB
testcase_04 AC 37 ms
52,912 KB
testcase_05 AC 37 ms
53,052 KB
testcase_06 AC 36 ms
53,240 KB
testcase_07 AC 37 ms
53,508 KB
testcase_08 AC 38 ms
53,504 KB
testcase_09 AC 37 ms
52,792 KB
testcase_10 AC 37 ms
53,016 KB
testcase_11 AC 38 ms
52,900 KB
testcase_12 AC 37 ms
52,888 KB
testcase_13 AC 38 ms
52,696 KB
testcase_14 AC 37 ms
52,028 KB
testcase_15 AC 37 ms
53,036 KB
testcase_16 AC 37 ms
52,776 KB
testcase_17 AC 36 ms
52,736 KB
testcase_18 AC 37 ms
52,544 KB
testcase_19 AC 37 ms
52,244 KB
testcase_20 AC 37 ms
53,828 KB
testcase_21 AC 37 ms
52,632 KB
testcase_22 AC 38 ms
53,212 KB
testcase_23 AC 37 ms
53,352 KB
testcase_24 AC 36 ms
52,004 KB
testcase_25 AC 36 ms
52,824 KB
testcase_26 AC 37 ms
54,096 KB
testcase_27 AC 37 ms
53,688 KB
testcase_28 AC 37 ms
52,284 KB
testcase_29 AC 38 ms
53,316 KB
testcase_30 AC 37 ms
52,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
grundy = [-1, 0, 1]
for i in range(101):
    if i == 0 or i == 1 or i == 2:
        continue;
    if i % 2 == 0:
        a = 0
    else:
        a = grundy[i // 2] ^ grundy[i // 2 + 1]
    if i % 3 == 1:
        b = grundy[i // 3 + 1]
    else:
        b = grundy[i // 3]
    g = 0
    while g == a or g == b:
        g+=1
    grundy.append(g)
print("B" if grundy[N]==0 else "A")
0