結果

問題 No.36 素数が嫌い!
ユーザー masumasumath1
提出日時 2019-12-07 23:40:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 390 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-12-26 16:55:14
合計ジャッジ時間 11,582 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#1,素数,自分自身以外で2つの約数を持つか
def hasTwoDivisor(N):
    cnt = 0
    i = 2
    while i*i <= N:
        if N%i == 0:
            cnt += 1
            N //= i
        if cnt == 2:
            return True
        i += 1
    else:
        return False
N = int(input())
if N == 1:
    print("NO")
    exit()
if hasTwoDivisor(N):
    print("YES")
else:
    print("NO")
0