結果

問題 No.103 素因数ゲーム リターンズ
ユーザー roaris
提出日時 2020-11-25 23:56:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 513 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,172 KB
実行使用メモリ 58,496 KB
最終ジャッジ日時 2024-07-23 19:33:37
合計ジャッジ時間 2,309 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

N = int(input())
M = list(map(int, input().split()))
G = 0

for Mi in M:
    fct = factorize(Mi)
    
    for _, c in fct:
        G ^= c%3

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