結果

問題 No.2 素因数ゲーム
ユーザー matsu7874matsu7874
提出日時 2015-08-14 15:40:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2023-09-25 11:39:19
合計ジャッジ時間 1,962 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,860 KB
testcase_01 AC 16 ms
7,732 KB
testcase_02 AC 16 ms
7,784 KB
testcase_03 AC 15 ms
7,780 KB
testcase_04 AC 15 ms
7,784 KB
testcase_05 AC 16 ms
7,724 KB
testcase_06 WA -
testcase_07 AC 16 ms
7,792 KB
testcase_08 AC 15 ms
7,748 KB
testcase_09 AC 15 ms
7,728 KB
testcase_10 AC 16 ms
7,888 KB
testcase_11 AC 16 ms
7,776 KB
testcase_12 AC 15 ms
7,860 KB
testcase_13 AC 15 ms
7,880 KB
testcase_14 AC 16 ms
7,776 KB
testcase_15 WA -
testcase_16 AC 16 ms
7,780 KB
testcase_17 AC 16 ms
7,876 KB
testcase_18 AC 16 ms
7,732 KB
testcase_19 AC 16 ms
7,876 KB
testcase_20 AC 16 ms
7,820 KB
testcase_21 AC 16 ms
7,780 KB
testcase_22 AC 15 ms
7,760 KB
testcase_23 AC 16 ms
7,808 KB
testcase_24 WA -
testcase_25 AC 16 ms
7,776 KB
testcase_26 AC 15 ms
7,712 KB
testcase_27 WA -
testcase_28 AC 15 ms
7,872 KB
testcase_29 AC 15 ms
7,808 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_decomposition(n):
    prime_factors = {}
    if n<2:
        return prime_factors
    while n >= 2 and n%2 == 0:
        if 2 in prime_factors:
            prime_factors[2] += 1
        else:
            prime_factors.update({2:1})
        n //= 2
    i = 3
    while i*i <= n:
        if n%i == 0:
            if i in prime_factors:
                prime_factors[i] += 1
            else:
                prime_factors.update({i:1})
            n //= i
        else:
            i += 2
    if n>1:
        if i in prime_factors:
            prime_factors[i] += 1
        else:
            prime_factors.update({i: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