結果

問題 No.153 石の山
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-08 14:20:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 567 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 71,480 KB
最終ジャッジ日時 2023-08-16 17:15:32
合計ジャッジ時間 4,235 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
70,820 KB
testcase_01 AC 69 ms
71,400 KB
testcase_02 AC 69 ms
71,072 KB
testcase_03 AC 71 ms
71,120 KB
testcase_04 AC 69 ms
71,136 KB
testcase_05 AC 69 ms
71,352 KB
testcase_06 AC 68 ms
70,848 KB
testcase_07 AC 71 ms
71,180 KB
testcase_08 AC 72 ms
71,052 KB
testcase_09 AC 71 ms
71,412 KB
testcase_10 AC 70 ms
71,444 KB
testcase_11 AC 72 ms
71,472 KB
testcase_12 AC 70 ms
71,144 KB
testcase_13 AC 70 ms
71,244 KB
testcase_14 AC 70 ms
71,444 KB
testcase_15 AC 69 ms
71,140 KB
testcase_16 AC 70 ms
71,388 KB
testcase_17 AC 73 ms
71,068 KB
testcase_18 AC 68 ms
71,364 KB
testcase_19 AC 68 ms
71,296 KB
testcase_20 AC 67 ms
71,136 KB
testcase_21 AC 67 ms
71,380 KB
testcase_22 AC 67 ms
71,264 KB
testcase_23 AC 69 ms
71,396 KB
testcase_24 AC 68 ms
71,228 KB
testcase_25 AC 69 ms
71,480 KB
testcase_26 AC 70 ms
71,040 KB
testcase_27 AC 68 ms
71,468 KB
testcase_28 AC 68 ms
71,240 KB
testcase_29 AC 72 ms
71,188 KB
testcase_30 AC 70 ms
71,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
g=[0]*(n+1)

def  ni(x):
    if x%2:return x//2,x//2 + 1
    else:return x//2,x//2

def  san(x):
    t=x//3
    if x%3 == 0:
        return t,t,t
    elif t*3 + 1 == x:
        return t,t,t+1
    elif t*3 + 2 == x:
        return t,t+1,t+1

    return False
    

for i in range(2,n+1):
    s = set()
    nit = ni(i)
    t = 0
    for j in nit:
        t^=g[j]
    s.add(t)
    t=0
    sat = san(i)
    for j in sat:
        t^=g[j]
    s.add(t)
    p = 0
    while p in s:
        p +=  1
    # print(p,i)
    g[i] = p

print('A' if g[n] > 0 else 'B')
0