結果

問題 No.36 素数が嫌い!
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-24 00:56:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 204 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 668 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 75,648 KB
最終ジャッジ日時 2023-09-16 20:26:06
合計ジャッジ時間 5,680 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
75,272 KB
testcase_01 AC 175 ms
75,240 KB
testcase_02 AC 68 ms
71,416 KB
testcase_03 AC 68 ms
71,604 KB
testcase_04 AC 68 ms
71,604 KB
testcase_05 AC 69 ms
75,388 KB
testcase_06 AC 71 ms
75,320 KB
testcase_07 AC 70 ms
75,648 KB
testcase_08 AC 73 ms
75,176 KB
testcase_09 AC 70 ms
75,360 KB
testcase_10 AC 67 ms
75,036 KB
testcase_11 AC 111 ms
75,272 KB
testcase_12 AC 203 ms
75,200 KB
testcase_13 AC 204 ms
75,204 KB
testcase_14 AC 153 ms
75,400 KB
testcase_15 AC 67 ms
71,364 KB
testcase_16 AC 67 ms
71,192 KB
testcase_17 AC 67 ms
70,980 KB
testcase_18 AC 68 ms
75,444 KB
testcase_19 AC 122 ms
75,176 KB
testcase_20 AC 204 ms
75,328 KB
testcase_21 AC 173 ms
75,268 KB
testcase_22 AC 176 ms
75,196 KB
testcase_23 AC 133 ms
75,228 KB
testcase_24 AC 145 ms
75,252 KB
testcase_25 AC 137 ms
75,256 KB
testcase_26 AC 152 ms
75,424 KB
testcase_27 AC 186 ms
75,320 KB
testcase_28 AC 149 ms
75,332 KB
testcase_29 AC 199 ms
75,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

if n == 1:
    print('NO')
    exit()

import math
def factorize(n):
    d = {}
    temp = int(math.sqrt(n))+1
    for i in range(2, temp):
        while n%i== 0:
            n //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[n] = 1
    else:
        if n in d:
            d[n] += 1
        elif n != 1:
            d[n] =1
    return d

d = factorize(n)
if len(d) == 1:
    for k, v in d.items():
        if v <= 2:
            print('NO')
        else:
            print('YES')
elif len(d) == 2:
    for k, v in d.items():
        if v >= 2:
            print('YES')
            exit()
    else:
        print('NO')
else:
    print('YES')
0