結果

問題 No.2 素因数ゲーム
ユーザー matsu7874matsu7874
提出日時 2016-01-08 05:47:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 8,632 KB
最終ジャッジ日時 2023-08-27 04:10:31
合計ジャッジ時間 1,957 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,468 KB
testcase_01 AC 20 ms
8,488 KB
testcase_02 AC 19 ms
8,480 KB
testcase_03 AC 19 ms
8,632 KB
testcase_04 AC 19 ms
8,420 KB
testcase_05 AC 19 ms
8,484 KB
testcase_06 AC 20 ms
8,604 KB
testcase_07 AC 19 ms
8,604 KB
testcase_08 AC 19 ms
8,480 KB
testcase_09 AC 19 ms
8,588 KB
testcase_10 AC 19 ms
8,552 KB
testcase_11 AC 19 ms
8,452 KB
testcase_12 AC 19 ms
8,424 KB
testcase_13 AC 19 ms
8,456 KB
testcase_14 AC 19 ms
8,440 KB
testcase_15 AC 19 ms
8,576 KB
testcase_16 AC 19 ms
8,476 KB
testcase_17 AC 18 ms
8,560 KB
testcase_18 AC 19 ms
8,464 KB
testcase_19 AC 20 ms
8,460 KB
testcase_20 AC 19 ms
8,580 KB
testcase_21 AC 19 ms
8,616 KB
testcase_22 AC 18 ms
8,448 KB
testcase_23 AC 19 ms
8,496 KB
testcase_24 AC 19 ms
8,452 KB
testcase_25 AC 19 ms
8,464 KB
testcase_26 AC 19 ms
8,408 KB
testcase_27 AC 18 ms
8,628 KB
testcase_28 AC 19 ms
8,492 KB
testcase_29 AC 18 ms
8,552 KB
testcase_30 AC 20 ms
8,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_decomposition(n):
    import collections
    prime_factors = collections.Counter()
    while n >= 2 and n % 2 == 0:
        prime_factors[2] += 1
        n //= 2
    i = 3
    while i * i <= n:
        if n % i == 0:
            prime_factors[i] += 1
            n //= i
        else:
            i += 2
    if n > 1:
        prime_factors[n] += 1
    return prime_factors

N = int(input())
win = 0
for p, v in prime_decomposition(N).items():
    win = win ^ v
if win != 0:
    print('Alice')
else:
    print('Bob')
0