結果

問題 No.2 素因数ゲーム
ユーザー HydruHydru
提出日時 2023-01-15 12:58:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 869 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 75,884 KB
最終ジャッジ日時 2023-08-27 20:36:28
合計ジャッジ時間 4,134 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,668 KB
testcase_01 AC 70 ms
71,948 KB
testcase_02 AC 70 ms
71,532 KB
testcase_03 AC 74 ms
71,464 KB
testcase_04 AC 68 ms
71,664 KB
testcase_05 AC 69 ms
71,564 KB
testcase_06 AC 70 ms
75,852 KB
testcase_07 AC 69 ms
71,836 KB
testcase_08 AC 71 ms
75,796 KB
testcase_09 AC 69 ms
71,612 KB
testcase_10 AC 68 ms
71,616 KB
testcase_11 AC 69 ms
71,736 KB
testcase_12 AC 82 ms
71,912 KB
testcase_13 AC 69 ms
71,804 KB
testcase_14 AC 70 ms
71,924 KB
testcase_15 AC 72 ms
75,800 KB
testcase_16 AC 72 ms
75,872 KB
testcase_17 AC 72 ms
75,768 KB
testcase_18 AC 71 ms
75,884 KB
testcase_19 AC 71 ms
75,824 KB
testcase_20 AC 71 ms
75,744 KB
testcase_21 AC 71 ms
75,816 KB
testcase_22 AC 70 ms
71,804 KB
testcase_23 AC 71 ms
75,808 KB
testcase_24 AC 70 ms
75,568 KB
testcase_25 AC 71 ms
75,728 KB
testcase_26 AC 70 ms
75,744 KB
testcase_27 AC 71 ms
75,768 KB
testcase_28 AC 70 ms
75,516 KB
testcase_29 AC 71 ms
75,844 KB
testcase_30 AC 68 ms
75,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

def factorization(n):
    # nを素因数分解したリストを返す
    arr = []
    tmp = n
    for i in [2,3]:
        if tmp%i==0:
            cnt=0
            while(tmp%i==0):
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    for i in range(5, int(-(-tmp**0.5//1))+1,2):
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp //= i
            arr.append([i, cnt])

    if tmp!=1:
        arr.append([tmp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

A=factorization(n)

B=[a[1] for a in A]

def Nim(A):
    #山取りゲーム
    #最後の山を取った人が勝ち
    p=0
    for a in A:
        p^=a
    if p==0:
        return 1 #後手
    else:
        return 0 #先手

if Nim(B)==1:
    print("Bob")
else:
    print("Alice")
0