結果

問題 No.103 素因数ゲーム リターンズ
ユーザー yn
提出日時 2015-10-07 17:19:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 740 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-20 01:53:21
合計ジャッジ時間 1,629 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def solve(M):
    x = 0
    for m in M:
        if m == 1:
            x ^= 1

        for i in num:
            if m < i * i:
                break

            cnt = 0
            while m % i == 0:
                m = m // i
                cnt += 1
            x ^= cnt % 3

        if m > 1:
            x ^= 1

    if x == 0:
        return False
    else:
        return True

N = 100
table = [True] * (N + 1)
num = []

for i in range(2, N + 1):
    if not table[i]:
        continue
    k = i + i
    while k < N + 1:
        table[k] = False
        k += i

    num.append(i)

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

if solve(M):
    print("Alice")
else:
    print("Bob")
0