結果

問題 No.1665 quotient replace
ユーザー ntuda
提出日時 2021-09-04 13:09:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,059 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 272,936 KB
最終ジャッジ日時 2024-12-17 22:04:11
合計ジャッジ時間 49,649 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 10 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

def seachPrimeNum(N):
    max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

def adic(dic,x):
    if x in dic:
        dic[x] += 1
    else:
        dic[x] = 1
    return

def factorization(x):
    dic = {}
    for p in PL:
        if x in PL:
            adic(dic,x)
            return dic
        while x % p == 0:
            adic(dic,p)
            x //= p
        if x == 1:
            return dic
    # ここには来ないはず
    print("factorization error")
    return "error"

# 約数の数
def N_divisors(x):
    dic = factorization(x)
    ret = 1
    for v in dic.values():
        ret *= (v+1)
    return ret

N = int(input())
A = list(map(int,input().split()))
PL = set(seachPrimeNum(max(A)))
G = 0
for i in range(N):
    G ^= (N_divisors(A[i]) - 1)

if G == 0:
    print("black")
else:
    print("white")

0