結果

問題 No.36 素数が嫌い!
ユーザー TomoyarnTomoyarn
提出日時 2023-01-07 09:28:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 1,701 ms
コンパイル使用メモリ 86,576 KB
実行使用メモリ 75,880 KB
最終ジャッジ日時 2023-08-21 01:17:44
合計ジャッジ時間 6,278 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 179 ms
75,684 KB
testcase_01 AC 198 ms
75,404 KB
testcase_02 AC 73 ms
71,304 KB
testcase_03 AC 72 ms
71,584 KB
testcase_04 AC 72 ms
71,536 KB
testcase_05 AC 76 ms
75,880 KB
testcase_06 AC 75 ms
75,568 KB
testcase_07 AC 74 ms
75,264 KB
testcase_08 AC 76 ms
75,628 KB
testcase_09 AC 76 ms
75,520 KB
testcase_10 AC 77 ms
75,620 KB
testcase_11 AC 127 ms
75,264 KB
testcase_12 AC 234 ms
75,340 KB
testcase_13 AC 232 ms
75,724 KB
testcase_14 WA -
testcase_15 AC 71 ms
71,384 KB
testcase_16 AC 72 ms
70,904 KB
testcase_17 AC 73 ms
71,248 KB
testcase_18 AC 78 ms
75,348 KB
testcase_19 AC 135 ms
75,740 KB
testcase_20 AC 233 ms
75,648 KB
testcase_21 AC 198 ms
75,548 KB
testcase_22 AC 198 ms
75,624 KB
testcase_23 AC 148 ms
75,584 KB
testcase_24 AC 158 ms
75,572 KB
testcase_25 AC 177 ms
75,688 KB
testcase_26 AC 214 ms
75,692 KB
testcase_27 AC 209 ms
75,576 KB
testcase_28 AC 210 ms
75,700 KB
testcase_29 AC 227 ms
75,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 not is_prime(y):
        print("YES")
        exit()

print("NO")
0