結果

問題 No.2 素因数ゲーム
ユーザー sotanishy
提出日時 2021-03-16 19:40:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 1,407 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 57,600 KB
最終ジャッジ日時 2024-11-08 09:25:14
合計ジャッジ時間 2,564 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_factor(n):
    factors = {}
    if n % 2 == 0:
        cnt = 0
        while n % 2 == 0:
            cnt += 1
            n //= 2
        factors[2] = cnt
    i = 3
    while i * i <= n:
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                cnt += 1
                n //= i
            factors[i] = cnt
        i += 2
    if n != 1:
        factors[n] = 1
    return factors

N = int(input())
xor = 0
for p, c in prime_factor(N).items():
    xor ^= c
print('Alice' if xor else 'Bob')
0