結果

問題 No.36 素数が嫌い!
ユーザー titiatitia
提出日時 2021-11-28 02:24:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 87,464 KB
実行使用メモリ 155,064 KB
最終ジャッジ日時 2023-09-13 07:15:04
合計ジャッジ時間 17,370 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 407 ms
154,792 KB
testcase_01 WA -
testcase_02 AC 563 ms
154,844 KB
testcase_03 AC 574 ms
154,472 KB
testcase_04 AC 573 ms
154,892 KB
testcase_05 AC 578 ms
154,600 KB
testcase_06 AC 566 ms
154,852 KB
testcase_07 AC 568 ms
154,680 KB
testcase_08 AC 408 ms
154,684 KB
testcase_09 AC 406 ms
154,804 KB
testcase_10 AC 421 ms
154,980 KB
testcase_11 AC 566 ms
154,952 KB
testcase_12 AC 580 ms
154,740 KB
testcase_13 AC 569 ms
154,744 KB
testcase_14 WA -
testcase_15 AC 404 ms
154,524 KB
testcase_16 AC 569 ms
154,940 KB
testcase_17 AC 577 ms
154,696 KB
testcase_18 AC 402 ms
154,848 KB
testcase_19 AC 401 ms
154,848 KB
testcase_20 AC 425 ms
154,964 KB
testcase_21 AC 405 ms
154,400 KB
testcase_22 AC 405 ms
154,760 KB
testcase_23 AC 411 ms
154,836 KB
testcase_24 WA -
testcase_25 AC 401 ms
154,568 KB
testcase_26 AC 596 ms
154,516 KB
testcase_27 AC 588 ms
154,848 KB
testcase_28 AC 575 ms
154,956 KB
testcase_29 AC 569 ms
154,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
x=10**7+5
L=math.floor(math.sqrt(x)) # 平方根を求める

Primelist=[i for i in range(x+1)]
Primelist[1]=0 # 1は素数でないので0にする.
 
for i in Primelist:
    if i>L:
        break
    if i==0:
        continue
    for j in range(2*i,x+1,i):
        Primelist[j]=0

N=int(input())
for i in range(2,10**7+5):
    if i!=N and Primelist[i]==0 and N%i==0:
        print("YES")
        break
else:
    print("NO")
0