結果

問題 No.36 素数が嫌い!
ユーザー yomo3yomo3
提出日時 2020-03-01 16:36:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 725 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 65,892 KB
最終ジャッジ日時 2024-04-21 22:18:27
合計ジャッジ時間 12,545 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def chk(n):
    if n == 1:
        return False
    f = []
    c = 0
    while n % 2 == 0:
        n //= 2
        c += 1
        if c >= 3: return True
    if c > 0:
        f.append([2, c])
    p = 3
    while p * p <= n:
        c = 0
        while n % p == 0:
            n //= p
            c += 1
            if c >= 3: return True
        if c > 0:
            f.append([p, c])
            if len(f) >= 3: return True
            if len(f) == 2 and any(x!=1 for _,x in f): return True
            p += 2
    if n != 1:
        f.append([n, 1])
        if len(f) >= 3: return True
        if len(f) == 2 and any(x!=1 for _,x in f): return True
    return False

N = int(input())

f = chk(N)

print('YES' if f else 'NO')
0