結果

問題 No.2 素因数ゲーム
ユーザー roarisroaris
提出日時 2019-08-23 08:43:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 76,208 KB
最終ジャッジ日時 2023-08-03 17:15:18
合計ジャッジ時間 5,105 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,552 KB
testcase_01 AC 75 ms
71,696 KB
testcase_02 AC 75 ms
71,956 KB
testcase_03 AC 74 ms
71,996 KB
testcase_04 AC 74 ms
71,760 KB
testcase_05 AC 73 ms
71,880 KB
testcase_06 AC 77 ms
76,036 KB
testcase_07 AC 75 ms
76,000 KB
testcase_08 AC 77 ms
75,676 KB
testcase_09 AC 77 ms
75,676 KB
testcase_10 AC 77 ms
75,744 KB
testcase_11 AC 78 ms
75,804 KB
testcase_12 AC 77 ms
75,996 KB
testcase_13 AC 77 ms
75,908 KB
testcase_14 AC 75 ms
76,012 KB
testcase_15 AC 77 ms
75,668 KB
testcase_16 AC 78 ms
75,880 KB
testcase_17 AC 76 ms
75,940 KB
testcase_18 AC 78 ms
75,884 KB
testcase_19 AC 76 ms
75,852 KB
testcase_20 AC 77 ms
76,004 KB
testcase_21 AC 76 ms
75,888 KB
testcase_22 AC 77 ms
75,952 KB
testcase_23 AC 78 ms
75,960 KB
testcase_24 AC 76 ms
75,964 KB
testcase_25 AC 76 ms
75,924 KB
testcase_26 AC 78 ms
75,860 KB
testcase_27 AC 77 ms
75,864 KB
testcase_28 AC 77 ms
75,680 KB
testcase_29 AC 77 ms
76,068 KB
testcase_30 AC 76 ms
76,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorize(n):
    factors = []
    
    for i in range(2, int(n**0.5) + 1):
        cnt = 0
        
        while n % i == 0:
            n //= i
            cnt += 1
        
        if cnt > 0:
            factors.append((i, cnt))
    
    if n > 1:
        factors.append((n, 1))
    
    return factors

N = int(input())
factors = factorize(N)
xor = factors[0][1]

for _, value in factors[1:]:
    xor ^= value

if xor == 0:
    print('Bob')
else:
    print('Alice')
0