結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2020-05-10 20:32:43 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 582 bytes |
| コンパイル時間 | 138 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-08 06:14:17 |
| 合計ジャッジ時間 | 11,991 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 WA * 3 |
ソースコード
import math
def isprime(n):
if n == 1:
return False
else:
for i in range(2, math.floor(math.sqrt(n))+1):
if n % i == 0:
return False
return True
def bunnkai(n):
pf = []
for i in range(2, math.floor(math.sqrt(n))+1):
if n % i == 0:
pf.append(i)
n //= i
return pf
n = int(input())
if n == 1:
print("NO")
elif isprime(n):
print("NO")
elif float.is_integer(math.sqrt(n)):
if isprime(math.floor(math.sqrt(n))):
print("NO")
else:
print("YES")
else:
soinsu = bunnkai(n)
cnt = len(soinsu)
if cnt == 1 or cnt == 0:
print("NO")
else:
print("YES")
shobonvip