結果

問題 No.36 素数が嫌い!
ユーザー TomoyarnTomoyarn
提出日時 2023-01-07 09:44:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 231 ms / 5,000 ms
コード長 688 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 76,052 KB
最終ジャッジ日時 2023-08-21 01:28:07
合計ジャッジ時間 5,836 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
75,924 KB
testcase_01 AC 201 ms
75,940 KB
testcase_02 AC 71 ms
71,572 KB
testcase_03 AC 72 ms
71,232 KB
testcase_04 AC 71 ms
71,144 KB
testcase_05 AC 78 ms
75,948 KB
testcase_06 AC 76 ms
75,672 KB
testcase_07 AC 77 ms
75,764 KB
testcase_08 AC 75 ms
75,880 KB
testcase_09 AC 75 ms
76,036 KB
testcase_10 AC 75 ms
75,768 KB
testcase_11 AC 125 ms
75,652 KB
testcase_12 AC 230 ms
75,476 KB
testcase_13 AC 229 ms
76,028 KB
testcase_14 AC 169 ms
75,948 KB
testcase_15 AC 72 ms
71,844 KB
testcase_16 AC 71 ms
71,696 KB
testcase_17 AC 72 ms
71,160 KB
testcase_18 AC 74 ms
75,768 KB
testcase_19 AC 134 ms
75,576 KB
testcase_20 AC 230 ms
75,888 KB
testcase_21 AC 190 ms
75,576 KB
testcase_22 AC 193 ms
75,968 KB
testcase_23 AC 151 ms
75,876 KB
testcase_24 AC 158 ms
76,052 KB
testcase_25 AC 158 ms
75,980 KB
testcase_26 AC 216 ms
75,704 KB
testcase_27 AC 210 ms
76,040 KB
testcase_28 AC 213 ms
76,000 KB
testcase_29 AC 231 ms
75,952 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):
    if n <= 3:
        return True
    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)

for y in yakusu:
    if not is_prime(y):
        print("YES")
        exit()

print("NO")
0