結果

問題 No.144 エラトステネスのざる
ユーザー yaoshimaxyaoshimax
提出日時 2015-05-01 00:15:35
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 249 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 77,184 KB
実行使用メモリ 94,080 KB
最終ジャッジ日時 2024-07-05 17:16:38
合計ジャッジ時間 3,183 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
91,904 KB
testcase_01 AC 89 ms
92,032 KB
testcase_02 WA -
testcase_03 AC 90 ms
91,776 KB
testcase_04 AC 90 ms
91,776 KB
testcase_05 AC 89 ms
92,032 KB
testcase_06 AC 92 ms
92,672 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 92 ms
92,672 KB
testcase_13 AC 149 ms
93,056 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 169 ms
93,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P=raw_input().split()
N=int(N)
P=float(P)
isPrime=[1.0 for i in xrange(1000001)]
isPrime[0]=0
isPrime[1]=0
ans=0
for i in range(2,N+1):
    #print i,isPrime[i]
    ans+=isPrime[i]
    for j in range(i*i,N+1,i):
        isPrime[j]*=(1-P)
print ans
0