結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
![]() |
提出日時 | 2020-05-10 20:34:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 618 bytes |
コンパイル時間 | 77 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-07-08 06:15:51 |
合計ジャッジ時間 | 12,209 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 WA * 7 |
ソースコード
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: if n%soinsu[0] == 0: print("YES") else: print("NO") else: print("YES")