結果

問題 No.1665 quotient replace
ユーザー 👑 rin204rin204
提出日時 2021-09-03 21:40:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,819 ms / 3,000 ms
コード長 641 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 247,012 KB
最終ジャッジ日時 2024-12-15 11:17:33
合計ジャッジ時間 19,510 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
alst = list(map(int, input().split()))
x = 0

max_ = 10 ** 4
isprime = [True] * (max_ + 1)
isprime[0] = isprime[1] = False
for i in range(2, int(max_ ** 0.5 + 1)):
    if not isprime[i]:
        continue
    for j in range(i * i, max_ + 1, i):
        isprime[j] = False
primes = []
for i, tf in enumerate(isprime):
    if tf:
        primes.append(i)

for a in alst:
    cnt = 0
    p = 0
    while primes[p] ** 2 <= a:
        while a % primes[p] == 0:
            a //= primes[p]
            cnt += 1
        p += 1
    if a != 1:
        cnt += 1
    x ^= cnt
    
if x == 0:
    print("black")
else:
    print("white")
0