結果

問題 No.36 素数が嫌い!
ユーザー tora3kuma3tora3kuma3
提出日時 2015-04-19 09:56:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 83,808 KB
最終ジャッジ日時 2023-09-18 00:42:07
合計ジャッジ時間 15,353 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
43,152 KB
testcase_01 WA -
testcase_02 AC 15 ms
8,372 KB
testcase_03 AC 17 ms
8,364 KB
testcase_04 AC 16 ms
8,396 KB
testcase_05 AC 18 ms
8,432 KB
testcase_06 AC 18 ms
8,460 KB
testcase_07 AC 19 ms
8,448 KB
testcase_08 AC 17 ms
8,388 KB
testcase_09 AC 16 ms
8,432 KB
testcase_10 AC 17 ms
8,480 KB
testcase_11 AC 435 ms
32,808 KB
testcase_12 AC 1,439 ms
83,628 KB
testcase_13 AC 1,442 ms
83,512 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 16 ms
8,356 KB
testcase_17 AC 16 ms
8,184 KB
testcase_18 AC 16 ms
8,292 KB
testcase_19 AC 272 ms
37,664 KB
testcase_20 WA -
testcase_21 AC 369 ms
65,664 KB
testcase_22 AC 568 ms
67,516 KB
testcase_23 AC 529 ms
43,780 KB
testcase_24 WA -
testcase_25 AC 114 ms
47,236 KB
testcase_26 AC 849 ms
53,896 KB
testcase_27 AC 1,237 ms
72,880 KB
testcase_28 AC 837 ms
53,016 KB
testcase_29 AC 1,383 ms
81,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
from itertools import compress, count
readline = stdin.readline


def sieve(n):
    p = [1] * (n + 1)
    p[0] = p[1] = 0

    for i in range(int(n ** 0.5) + 1):
        if p[i]:
            yield i
            for j in range(2 * i, len(p), i):
                p[j] = 0


def is_dividable_nonprime(n):
    cnt = 0
    for i in sieve(int(n ** 0.5)):
        while n % i == 0:
            cnt += 1
            n //= i
            if cnt == 2:
                return n != 1
    return False


def solve(n):
    print('YES' if is_dividable_nonprime(n) else 'NO')


def main():
    n = int(readline())
    solve(n)
main()
0