結果

問題 No.2 素因数ゲーム
ユーザー nagitaosu
提出日時 2020-03-13 01:08:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 535 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-20 16:42:48
合計ジャッジ時間 2,481 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
input = sys.stdin.readline
from collections import Counter

n = int(input())

def prime_factorize(n, unique=False):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    if unique:
        return set(fct)
    else:
        return fct

fac = prime_factorize(n)
cnt = Counter(fac)

nim = 0
for key in cnt.keys():
    nim ^= cnt[key]
if nim:
    print("Alice")
else:
    print("Bob")
0