結果

問題 No.36 素数が嫌い!
ユーザー TomoyarnTomoyarn
提出日時 2023-01-07 09:39:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 76,196 KB
最終ジャッジ日時 2023-08-21 01:24:52
合計ジャッジ時間 5,915 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
76,088 KB
testcase_01 AC 196 ms
75,976 KB
testcase_02 AC 71 ms
71,316 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 73 ms
75,852 KB
testcase_07 AC 72 ms
75,564 KB
testcase_08 AC 73 ms
75,956 KB
testcase_09 AC 73 ms
75,864 KB
testcase_10 AC 73 ms
75,984 KB
testcase_11 AC 122 ms
75,472 KB
testcase_12 AC 228 ms
75,332 KB
testcase_13 AC 229 ms
76,168 KB
testcase_14 AC 171 ms
76,060 KB
testcase_15 AC 70 ms
71,432 KB
testcase_16 AC 70 ms
71,492 KB
testcase_17 AC 70 ms
71,324 KB
testcase_18 AC 74 ms
76,196 KB
testcase_19 AC 136 ms
76,084 KB
testcase_20 AC 227 ms
76,104 KB
testcase_21 AC 193 ms
75,844 KB
testcase_22 AC 195 ms
75,996 KB
testcase_23 AC 144 ms
76,020 KB
testcase_24 AC 157 ms
76,096 KB
testcase_25 AC 151 ms
76,156 KB
testcase_26 AC 215 ms
76,040 KB
testcase_27 AC 209 ms
75,952 KB
testcase_28 AC 211 ms
76,180 KB
testcase_29 AC 225 ms
76,088 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 + 1):
        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