結果

問題 No.36 素数が嫌い!
ユーザー yakeshibayakeshiba
提出日時 2020-09-14 17:08:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 238 ms / 5,000 ms
コード長 706 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 75,656 KB
最終ジャッジ日時 2023-09-04 00:45:02
合計ジャッジ時間 4,578 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
75,272 KB
testcase_01 AC 79 ms
75,140 KB
testcase_02 AC 78 ms
71,164 KB
testcase_03 AC 76 ms
71,248 KB
testcase_04 AC 77 ms
70,912 KB
testcase_05 AC 78 ms
75,232 KB
testcase_06 AC 79 ms
75,652 KB
testcase_07 AC 79 ms
75,404 KB
testcase_08 AC 75 ms
71,296 KB
testcase_09 AC 75 ms
71,108 KB
testcase_10 AC 78 ms
75,408 KB
testcase_11 AC 130 ms
75,364 KB
testcase_12 AC 238 ms
75,144 KB
testcase_13 AC 236 ms
75,360 KB
testcase_14 AC 76 ms
75,360 KB
testcase_15 AC 75 ms
70,844 KB
testcase_16 AC 75 ms
70,936 KB
testcase_17 AC 75 ms
71,136 KB
testcase_18 AC 75 ms
71,304 KB
testcase_19 AC 85 ms
75,656 KB
testcase_20 AC 82 ms
75,212 KB
testcase_21 AC 99 ms
75,180 KB
testcase_22 AC 79 ms
75,400 KB
testcase_23 AC 78 ms
75,380 KB
testcase_24 AC 103 ms
75,364 KB
testcase_25 AC 107 ms
75,212 KB
testcase_26 AC 134 ms
75,196 KB
testcase_27 AC 81 ms
75,484 KB
testcase_28 AC 134 ms
75,148 KB
testcase_29 AC 78 ms
75,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

n = int(input())

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

fac = factorize(n)

if len(fac) >= 3:
    print('YES')
elif len(fac) == 2:
    if fac[0][1] >= 2 or fac[1][1] >= 2:
        print('YES')
    else:
        print('NO')
else:
    if fac[0][1] >= 2:
        if fac[0][1] == 2 and fac[0][0]**fac[0][1] == n:
            print('NO')
        else:
            print('YES')
    else:
        print('NO')
0