結果

問題 No.36 素数が嫌い!
ユーザー roarisroaris
提出日時 2019-08-08 11:20:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-09-25 23:37:50
合計ジャッジ時間 12,821 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 438 ms
7,828 KB
testcase_01 AC 572 ms
7,928 KB
testcase_02 AC 15 ms
7,748 KB
testcase_03 AC 15 ms
7,824 KB
testcase_04 AC 15 ms
7,916 KB
testcase_05 AC 17 ms
7,868 KB
testcase_06 AC 18 ms
7,800 KB
testcase_07 AC 18 ms
7,812 KB
testcase_08 AC 16 ms
7,820 KB
testcase_09 AC 17 ms
7,816 KB
testcase_10 AC 17 ms
7,800 KB
testcase_11 AC 318 ms
7,972 KB
testcase_12 AC 943 ms
7,828 KB
testcase_13 AC 935 ms
7,788 KB
testcase_14 AC 415 ms
7,984 KB
testcase_15 AC 15 ms
7,824 KB
testcase_16 AC 15 ms
7,828 KB
testcase_17 WA -
testcase_18 AC 16 ms
7,960 KB
testcase_19 AC 373 ms
7,932 KB
testcase_20 AC 758 ms
7,800 KB
testcase_21 AC 713 ms
7,904 KB
testcase_22 AC 742 ms
7,856 KB
testcase_23 AC 457 ms
7,788 KB
testcase_24 AC 403 ms
7,920 KB
testcase_25 AC 498 ms
7,852 KB
testcase_26 AC 570 ms
7,860 KB
testcase_27 AC 798 ms
7,924 KB
testcase_28 AC 571 ms
7,872 KB
testcase_29 AC 910 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

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