結果

問題 No.36 素数が嫌い!
ユーザー c-yanc-yan
提出日時 2021-01-09 00:26:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 403 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-08-10 13:32:38
合計ジャッジ時間 6,050 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
7,972 KB
testcase_01 AC 183 ms
7,876 KB
testcase_02 AC 15 ms
7,860 KB
testcase_03 AC 15 ms
7,828 KB
testcase_04 AC 15 ms
7,968 KB
testcase_05 AC 16 ms
7,868 KB
testcase_06 AC 16 ms
7,804 KB
testcase_07 AC 16 ms
7,832 KB
testcase_08 AC 15 ms
7,868 KB
testcase_09 AC 15 ms
7,856 KB
testcase_10 AC 16 ms
7,808 KB
testcase_11 AC 139 ms
7,928 KB
testcase_12 AC 403 ms
7,824 KB
testcase_13 AC 392 ms
7,856 KB
testcase_14 AC 16 ms
7,872 KB
testcase_15 AC 15 ms
7,880 KB
testcase_16 AC 15 ms
7,848 KB
testcase_17 AC 15 ms
7,972 KB
testcase_18 AC 15 ms
7,836 KB
testcase_19 AC 123 ms
7,816 KB
testcase_20 AC 314 ms
7,972 KB
testcase_21 AC 223 ms
7,856 KB
testcase_22 AC 317 ms
7,800 KB
testcase_23 AC 199 ms
7,932 KB
testcase_24 AC 81 ms
7,932 KB
testcase_25 AC 215 ms
7,876 KB
testcase_26 AC 242 ms
7,932 KB
testcase_27 AC 340 ms
7,892 KB
testcase_28 AC 247 ms
7,808 KB
testcase_29 AC 383 ms
7,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


N = int(input())
t = 0
for p, e in prime_factorize(N):
    t += e
if t > 2:
    print('YES')
else:
    print('NO')
0