結果

問題 No.2 素因数ゲーム
ユーザー Hydru
提出日時 2021-11-12 00:12:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 58,496 KB
最終ジャッジ日時 2024-11-23 23:44:20
合計ジャッジ時間 2,633 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(n):
    arr = []
    if n==1:
        return arr
    tmp = n
    def judge(i:int,N:int):
        if N%i==0:
            cnt=0
            while(N%i==0):
                cnt+=1
                N//=i
            arr.append(cnt)
        return N
    tmp=judge(2,tmp)
    tmp=judge(3,tmp)
    i=6
    while((i-1)**2<=tmp):
        tmp=judge(i-1,tmp)
        tmp=judge(i+1,tmp)
        i+=6
    if tmp!=1:
        arr.append(1)

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

    return arr

n=int(input())

primes=factorization(n)
ans=0
for x in primes:
    ans^=x
if ans:
    print("Alice")
else:
    print("Bob")
0