結果

問題 No.36 素数が嫌い!
ユーザー roaris
提出日時 2019-08-08 11:20:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-18 19:08:43
合計ジャッジ時間 14,777 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorize(n):
    factors = []
    
    for div in range(2, int(n**0.5) + 1):
        cnt = 0
        while n % div == 0:
            n //= div
            cnt += 1
        if cnt > 0:
            factors.append((div, cnt))
    
    if n > 1:
        factors.append((n, 1))
    
    return factors

N = int(input())
factors = factorize(N)

if len(factors) == 1:
    _, cnt = factors[0]
    
    if cnt >= 3:
        print('YES')
    else:
        print('NO')
elif len(factors) == 2:
    _, cnt1 = factors[0]
    _, cnt2 = factors[1]
    
    if cnt1 >= 2 or cnt2 >= 2:
        print('YES')
    else:
        print('NO')
else:
    print('YES')
0