結果

問題 No.36 素数が嫌い!
ユーザー AT274_AT274_
提出日時 2019-11-05 22:03:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 109,176 KB
最終ジャッジ日時 2023-10-13 02:30:11
合計ジャッジ時間 28,737 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 836 ms
55,564 KB
testcase_01 AC 1,472 ms
87,188 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 16 ms
7,784 KB
testcase_04 AC 16 ms
7,828 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 25 ms
8,832 KB
testcase_08 AC 18 ms
8,488 KB
testcase_09 AC 19 ms
8,616 KB
testcase_10 AC 19 ms
8,648 KB
testcase_11 AC 1,034 ms
41,988 KB
testcase_12 AC 3,350 ms
109,176 KB
testcase_13 AC 3,303 ms
109,036 KB
testcase_14 AC 1,164 ms
71,356 KB
testcase_15 AC 16 ms
7,960 KB
testcase_16 AC 16 ms
7,816 KB
testcase_17 AC 16 ms
7,760 KB
testcase_18 AC 16 ms
7,764 KB
testcase_19 AC 708 ms
48,372 KB
testcase_20 AC 1,961 ms
109,048 KB
testcase_21 AC 1,444 ms
85,704 KB
testcase_22 AC 1,505 ms
88,012 KB
testcase_23 AC 902 ms
56,488 KB
testcase_24 AC 988 ms
62,000 KB
testcase_25 AC 965 ms
61,036 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())


def eratosthenes_sieve(n):
    if n < 2:
        return []

    is_primes = [True] * (n + 1)
    for x in range(2, int(n ** 0.5 + 1) + 1):
        if is_primes[x]:
            for mx in range(2 * x, n + 1, x):
                is_primes[mx] = False

    return [i for i in range(2, n + 1) if is_primes[i]]


Primes = set(eratosthenes_sieve(int(N ** 0.5) + 2))
for n in range(2, int(N ** 0.5) + 1):
    if N % n == 0:
        nn = N // n
        if not ((n in Primes) and (nn in Primes)):
            print('YES')
            break
else:
    print('NO')
0