結果

問題 No.36 素数が嫌い!
ユーザー DialBirdDialBird
提出日時 2017-03-12 17:14:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 458 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,624 KB
実行使用メモリ 86,340 KB
最終ジャッジ日時 2023-09-09 07:55:33
合計ジャッジ時間 62,285 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,324 ms
86,188 KB
testcase_01 AC 3,637 ms
86,208 KB
testcase_02 AC 115 ms
86,240 KB
testcase_03 AC 114 ms
86,304 KB
testcase_04 AC 115 ms
86,164 KB
testcase_05 AC 127 ms
86,192 KB
testcase_06 AC 126 ms
86,220 KB
testcase_07 AC 127 ms
86,192 KB
testcase_08 AC 117 ms
86,248 KB
testcase_09 AC 123 ms
86,244 KB
testcase_10 AC 123 ms
86,228 KB
testcase_11 AC 1,706 ms
86,172 KB
testcase_12 TLE -
testcase_13 AC 4,981 ms
86,236 KB
testcase_14 AC 2,061 ms
86,240 KB
testcase_15 AC 116 ms
86,276 KB
testcase_16 AC 115 ms
86,164 KB
testcase_17 AC 116 ms
86,188 KB
testcase_18 AC 117 ms
86,264 KB
testcase_19 AC 1,972 ms
86,320 KB
testcase_20 AC 4,874 ms
86,340 KB
testcase_21 AC 3,780 ms
86,244 KB
testcase_22 AC 3,907 ms
86,292 KB
testcase_23 AC 2,356 ms
86,264 KB
testcase_24 AC 2,176 ms
86,296 KB
testcase_25 AC 2,553 ms
86,244 KB
testcase_26 AC 3,033 ms
86,168 KB
testcase_27 AC 4,242 ms
86,220 KB
testcase_28 AC 2,952 ms
86,244 KB
testcase_29 AC 4,763 ms
86,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

N = int(input())

prime_checker = [1]*10000001
primes = set([])
sqrt_n = int(sqrt(N))
cnt = 0

for i in range(2, sqrt_n + 1):
    if prime_checker[i] == 1:
        if N == 1: break

        while N % i == 0:
            N //= i
            cnt += 1
            if cnt >= 3: break

        for j in range(i*2, sqrt_n + 1, i):
            prime_checker[j] = 0

if N != 1:
    cnt += 1

if cnt >= 3:
    print("YES")
else:
    print("NO")
0