結果

問題 No.2 素因数ゲーム
ユーザー taisuke
提出日時 2023-02-18 19:51:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 509 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-20 03:59:56
合計ジャッジ時間 2,290 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_factor(n):
    ret = []
    nmax = int(n**0.5 + 1)
    x = n
    for i in range(2, nmax):
        if x % i == 0:
            cnt = 0
            while x % i == 0:
                cnt += 1
                x //= i
            ret.append([i, cnt])
    if x != 1:
        ret.append([x, 1])
    if ret == []:
        ret.append([n, 1])
    return ret


n = int(input())
prime = prime_factor(n)
xor_sum = 0
for x in prime:
    xor_sum ^= x[1]
if (xor_sum != 0):
    print("Alice")
else:
    print("Bob")
0