結果
問題 | No.36 素数が嫌い! |
ユーザー |
|
提出日時 | 2023-01-07 09:24:00 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 660 bytes |
コンパイル時間 | 835 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 58,112 KB |
最終ジャッジ日時 | 2024-12-14 08:54:22 |
合計ジャッジ時間 | 4,209 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 9 |
ソースコード
import math N = int(input()) if N == 1: exit(print("NO")) def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def is_prime(n): sqrt_n = math.ceil(n ** 0.5) for i in range(2, sqrt_n): if n % i == 0: return False return True yakusu = make_divisors(N) yakusu.pop(0) yakusu.pop(-1) #print(yakusu) for y in yakusu: if is_prime(y): print("YES") exit() print("NO")