結果

問題 No.36 素数が嫌い!
ユーザー momoyuumomoyuu
提出日時 2022-08-03 00:25:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 76,116 KB
最終ジャッジ日時 2023-10-01 01:05:19
合計ジャッジ時間 5,831 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
75,888 KB
testcase_01 WA -
testcase_02 AC 68 ms
71,484 KB
testcase_03 AC 70 ms
71,608 KB
testcase_04 AC 70 ms
71,352 KB
testcase_05 AC 73 ms
75,804 KB
testcase_06 AC 73 ms
75,628 KB
testcase_07 AC 72 ms
75,812 KB
testcase_08 WA -
testcase_09 AC 73 ms
75,816 KB
testcase_10 WA -
testcase_11 AC 115 ms
75,600 KB
testcase_12 AC 204 ms
75,664 KB
testcase_13 AC 204 ms
75,808 KB
testcase_14 AC 173 ms
75,816 KB
testcase_15 WA -
testcase_16 AC 72 ms
71,180 KB
testcase_17 AC 69 ms
71,116 KB
testcase_18 AC 72 ms
75,788 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 147 ms
75,612 KB
testcase_26 AC 160 ms
75,812 KB
testcase_27 AC 215 ms
75,824 KB
testcase_28 AC 160 ms
75,428 KB
testcase_29 AC 230 ms
75,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N == 1:
    print("NO")
    exit()

import math
m = math.floor(math.sqrt(N))
d = {}

for i in range(2,m):
    while N % i == 0:
        if not i in d:
            d[i] = 0
        d[i] += 1
        N //= i
if not N == 1:
    if not N in d:
        d[N] = 0
    d[N] += 1

a = 0
b = 0
for i in d:
    if d[i] >= 3:
        print("YES")
        exit()
    if d[i] == 2:
        a += 1
    elif d[i] == 1:
        b += 1
if a >= 2 or (a == 1 and b != 0):
    print("YES")
    exit()
print("NO")
0