結果

問題 No.36 素数が嫌い!
ユーザー masumasumath1masumasumath1
提出日時 2019-12-07 23:43:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 10,484 KB
実行使用メモリ 8,096 KB
最終ジャッジ日時 2023-08-27 06:23:13
合計ジャッジ時間 13,566 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 41 ms
7,812 KB
testcase_02 AC 15 ms
7,944 KB
testcase_03 AC 14 ms
7,932 KB
testcase_04 AC 14 ms
7,756 KB
testcase_05 AC 18 ms
7,816 KB
testcase_06 AC 19 ms
7,872 KB
testcase_07 AC 19 ms
7,852 KB
testcase_08 AC 14 ms
7,808 KB
testcase_09 AC 14 ms
7,880 KB
testcase_10 AC 15 ms
7,928 KB
testcase_11 AC 505 ms
7,880 KB
testcase_12 AC 1,544 ms
7,812 KB
testcase_13 AC 1,545 ms
7,824 KB
testcase_14 WA -
testcase_15 AC 15 ms
7,792 KB
testcase_16 AC 15 ms
7,908 KB
testcase_17 AC 14 ms
8,096 KB
testcase_18 AC 14 ms
7,776 KB
testcase_19 AC 15 ms
7,812 KB
testcase_20 AC 62 ms
7,900 KB
testcase_21 AC 15 ms
7,860 KB
testcase_22 AC 15 ms
7,868 KB
testcase_23 AC 15 ms
7,796 KB
testcase_24 AC 228 ms
7,828 KB
testcase_25 WA -
testcase_26 AC 935 ms
7,772 KB
testcase_27 AC 1,342 ms
7,948 KB
testcase_28 AC 936 ms
7,788 KB
testcase_29 AC 1,521 ms
7,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#1,素数,自分自身以外で2つの約数を持つか
def hasTwoDivisor(N):
    N0 = N
    cnt = 0
    i = 2
    while i*i <= N0:
        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