結果

問題 No.36 素数が嫌い!
ユーザー MamonboMamonbo
提出日時 2015-11-05 17:58:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-10-11 14:05:59
合計ジャッジ時間 8,922 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,804 KB
testcase_01 AC 56 ms
7,816 KB
testcase_02 AC 15 ms
7,788 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 22 ms
7,796 KB
testcase_08 AC 15 ms
7,772 KB
testcase_09 AC 14 ms
7,752 KB
testcase_10 AC 15 ms
7,756 KB
testcase_11 AC 731 ms
7,744 KB
testcase_12 AC 2,228 ms
7,808 KB
testcase_13 WA -
testcase_14 AC 23 ms
7,732 KB
testcase_15 AC 15 ms
7,788 KB
testcase_16 AC 15 ms
7,760 KB
testcase_17 AC 15 ms
7,900 KB
testcase_18 AC 15 ms
7,796 KB
testcase_19 AC 15 ms
7,888 KB
testcase_20 AC 88 ms
7,808 KB
testcase_21 AC 15 ms
7,816 KB
testcase_22 AC 15 ms
7,740 KB
testcase_23 AC 15 ms
7,752 KB
testcase_24 AC 331 ms
7,916 KB
testcase_25 AC 15 ms
7,888 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding=UTF-8

N=int(input())
#自分以外の合成数で割れればいい
#素数を3つ以上もつと自分以外の合成数をもつ
PrimeCount=0
Diviser=3
while N%2==0:
    N=N//2
    PrimeCount=PrimeCount+1

    
while PrimeCount<2:
    while N%Diviser==0:
        N=N//Diviser
        PrimeCount=PrimeCount+1
    if (N//Diviser+1)<Diviser or N<=Diviser:#商(単調減少)が割る数よりかなり小さいともう望みがない
        break
    Diviser=Diviser+2#2以外の素数は奇数

if N !=1:
    PrimeCount=PrimeCount+1#オマケ
if PrimeCount<2:
    print('NO')
else:
    print('YES')
0