結果

問題 No.2 素因数ゲーム
ユーザー ntuda
提出日時 2024-02-13 20:29:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 60,548 KB
最終ジャッジ日時 2024-09-28 18:36:48
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def n_fact(N):
    c = collections.Counter(prime_factorize(N))
    return c

N = int(input())
D = n_fact(N)
x = 0
if len(D) == 1:
    print("Alice")
    exit()
for v in D.values():
    x ^= v
if x == 0:
    print("Bob")
else:
    print("Alice")


0