結果

問題 No.36 素数が嫌い!
ユーザー lenoleno
提出日時 2017-08-20 12:49:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,545 ms / 5,000 ms
コード長 833 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 7,900 KB
最終ジャッジ日時 2023-09-09 08:08:53
合計ジャッジ時間 21,463 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 891 ms
7,856 KB
testcase_01 AC 1,169 ms
7,796 KB
testcase_02 AC 16 ms
7,788 KB
testcase_03 AC 17 ms
7,748 KB
testcase_04 AC 17 ms
7,764 KB
testcase_05 AC 21 ms
7,712 KB
testcase_06 AC 20 ms
7,788 KB
testcase_07 AC 21 ms
7,792 KB
testcase_08 AC 18 ms
7,900 KB
testcase_09 AC 20 ms
7,748 KB
testcase_10 AC 19 ms
7,756 KB
testcase_11 AC 488 ms
7,736 KB
testcase_12 AC 1,476 ms
7,756 KB
testcase_13 AC 1,463 ms
7,800 KB
testcase_14 AC 888 ms
7,856 KB
testcase_15 AC 16 ms
7,816 KB
testcase_16 AC 16 ms
7,792 KB
testcase_17 AC 15 ms
7,780 KB
testcase_18 AC 17 ms
7,792 KB
testcase_19 AC 677 ms
7,760 KB
testcase_20 AC 1,545 ms
7,848 KB
testcase_21 AC 1,356 ms
7,760 KB
testcase_22 AC 1,272 ms
7,844 KB
testcase_23 AC 758 ms
7,768 KB
testcase_24 AC 848 ms
7,712 KB
testcase_25 AC 971 ms
7,736 KB
testcase_26 AC 1,176 ms
7,708 KB
testcase_27 AC 1,376 ms
7,856 KB
testcase_28 AC 1,154 ms
7,900 KB
testcase_29 AC 1,536 ms
7,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_decomposition(N):
    M = N
    i = 2
    table =[]
    while i * i <= N:
        while M % i == 0:
            M /= i
            table.append(int(i))
        i += 1
    if M > 1:
        table.append(int(M))
    return table


def not_prime_table(N):
    table = []
    i = 3
    while i * i <= N:
        if not is_prime_number(i):
            table.append(i)
        i += 2
    return table


def is_prime_number(N):
    if N in [1, 2]:
        return True
    elif N == 0:
        return False
    else:
        i = 3
        while i * i <= N:
            if N % i == 0:
                return False
        return True


if __name__ == '__main__':
    N = int(input())
    li = prime_decomposition(N)
    if len(li) <= 2:
        print('NO')
    else:
        print('YES')
0