結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 43 ms
7,856 KB
testcase_02 AC 14 ms
7,896 KB
testcase_03 AC 14 ms
7,880 KB
testcase_04 AC 15 ms
7,896 KB
testcase_05 AC 17 ms
7,856 KB
testcase_06 AC 19 ms
7,856 KB
testcase_07 AC 19 ms
7,876 KB
testcase_08 AC 14 ms
7,868 KB
testcase_09 AC 15 ms
7,780 KB
testcase_10 AC 14 ms
7,788 KB
testcase_11 AC 517 ms
7,868 KB
testcase_12 AC 1,567 ms
7,796 KB
testcase_13 AC 1,569 ms
7,944 KB
testcase_14 WA -
testcase_15 AC 15 ms
7,948 KB
testcase_16 AC 15 ms
7,780 KB
testcase_17 AC 15 ms
8,124 KB
testcase_18 AC 14 ms
7,940 KB
testcase_19 AC 15 ms
7,868 KB
testcase_20 AC 66 ms
7,864 KB
testcase_21 AC 15 ms
7,820 KB
testcase_22 AC 15 ms
7,816 KB
testcase_23 AC 15 ms
7,856 KB
testcase_24 AC 241 ms
7,856 KB
testcase_25 WA -
testcase_26 AC 567 ms
7,952 KB
testcase_27 AC 42 ms
7,784 KB
testcase_28 AC 559 ms
7,948 KB
testcase_29 AC 25 ms
7,912 KB
権限があれば一括ダウンロードができます

ソースコード

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