結果

問題 No.144 エラトステネスのざる
ユーザー yaoshimaxyaoshimax
提出日時 2015-05-01 00:15:35
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 249 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 77,720 KB
実行使用メモリ 94,856 KB
最終ジャッジ日時 2023-09-19 04:46:21
合計ジャッジ時間 3,902 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
93,000 KB
testcase_01 AC 88 ms
92,780 KB
testcase_02 WA -
testcase_03 AC 88 ms
93,052 KB
testcase_04 AC 88 ms
93,324 KB
testcase_05 AC 87 ms
92,864 KB
testcase_06 AC 95 ms
94,324 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 92 ms
94,304 KB
testcase_13 AC 165 ms
94,124 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 170 ms
94,260 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