結果
問題 |
No.1665 quotient replace
|
ユーザー |
![]() |
提出日時 | 2021-09-04 14:00:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,870 ms / 3,000 ms |
コード長 | 869 bytes |
コンパイル時間 | 755 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 272,456 KB |
最終ジャッジ日時 | 2024-12-17 23:55:42 |
合計ジャッジ時間 | 44,463 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
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 n_factorization(x): cnt = 0 for p in PL: if x in PL: cnt += 1 return cnt while x % p == 0: cnt += 1 x //= p if x == 1: return cnt # ここには来ないはず print("factorization error") return "error" N = int(input()) A = list(map(int,input().split())) PL = set(seachPrimeNum(max(max(A),2))) G = 0 for i in range(N): if A[i] != 1: G ^= (n_factorization(A[i])) if G == 0: print("black") else: print("white")