結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
kbys
|
| 提出日時 | 2020-09-14 16:55:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 607 bytes |
| コンパイル時間 | 102 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-06-22 00:52:09 |
| 合計ジャッジ時間 | 8,601 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 WA * 2 |
ソースコード
def factorize(n):
fct = [] # prime factor
b, e = 2, 0 # base, exponent
while b * b <= n:
while n % b == 0:
n = n // b
e = e + 1
if e > 0:
fct.append((b, e))
b, e = b + 1, 0
if n > 1:
fct.append((n, 1))
return fct
n = int(input())
if n == 1:
print('NO')
exit()
fac = factorize(n)
if len(fac) >= 3:
print('YES')
elif len(fac) == 2:
if fac[0][1] >= 2 or fac[1][1] >= 2:
print('YES')
else:
print('NO')
else:
if fac[0][1] >= 2:
print('YES')
else:
print('NO')
kbys