結果

問題 No.36 素数が嫌い!
ユーザー szkhts
提出日時 2021-08-07 18:02:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,364 ms / 5,000 ms
コード長 433 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-18 19:35:56
合計ジャッジ時間 12,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())

def is_prime(n):
    i = 2
    result = []
    M = n
    while i <= math.sqrt(n):
        if n % i == 0:
            result.append(i)
            if len(result) >= 2:
                if result[0] * result[1] < M:
                    return 'YES'
                else:
                    return 'NO'

            n = n // i
        elif n % i > 0:
            i += 1
    return 'NO'

print(is_prime(N))
0