結果

問題 No.36 素数が嫌い!
ユーザー yakeshibayakeshiba
提出日時 2020-09-14 17:05:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 75,464 KB
最終ジャッジ日時 2023-09-04 00:44:33
合計ジャッジ時間 4,574 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
75,364 KB
testcase_01 AC 82 ms
75,176 KB
testcase_02 AC 77 ms
70,992 KB
testcase_03 AC 76 ms
71,012 KB
testcase_04 WA -
testcase_05 AC 79 ms
75,384 KB
testcase_06 AC 79 ms
75,188 KB
testcase_07 AC 80 ms
75,328 KB
testcase_08 AC 75 ms
71,300 KB
testcase_09 AC 75 ms
70,904 KB
testcase_10 AC 76 ms
75,328 KB
testcase_11 AC 128 ms
75,360 KB
testcase_12 AC 240 ms
75,236 KB
testcase_13 WA -
testcase_14 AC 78 ms
75,288 KB
testcase_15 AC 76 ms
71,092 KB
testcase_16 AC 76 ms
71,088 KB
testcase_17 AC 75 ms
70,852 KB
testcase_18 AC 76 ms
71,244 KB
testcase_19 AC 85 ms
75,372 KB
testcase_20 AC 84 ms
75,180 KB
testcase_21 AC 100 ms
75,140 KB
testcase_22 AC 82 ms
75,360 KB
testcase_23 AC 79 ms
75,360 KB
testcase_24 AC 99 ms
75,376 KB
testcase_25 AC 105 ms
75,372 KB
testcase_26 AC 133 ms
75,368 KB
testcase_27 AC 79 ms
75,368 KB
testcase_28 AC 133 ms
75,464 KB
testcase_29 AC 83 ms
75,156 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:
        print('YES')
    else:
        print('NO')
0