結果

問題 No.144 エラトステネスのざる
ユーザー cielciel
提出日時 2015-02-08 18:08:38
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 149 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 77,696 KB
実行使用メモリ 94,340 KB
最終ジャッジ日時 2023-09-05 15:49:20
合計ジャッジ時間 3,557 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
76,316 KB
testcase_01 AC 73 ms
76,172 KB
testcase_02 AC 73 ms
76,376 KB
testcase_03 AC 73 ms
76,620 KB
testcase_04 AC 74 ms
76,468 KB
testcase_05 AC 74 ms
76,288 KB
testcase_06 AC 80 ms
78,948 KB
testcase_07 AC 82 ms
79,280 KB
testcase_08 AC 82 ms
79,032 KB
testcase_09 AC 83 ms
78,984 KB
testcase_10 AC 81 ms
79,128 KB
testcase_11 AC 81 ms
79,084 KB
testcase_12 AC 81 ms
79,260 KB
testcase_13 AC 195 ms
94,076 KB
testcase_14 AC 195 ms
94,132 KB
testcase_15 AC 204 ms
94,340 KB
testcase_16 AC 192 ms
94,192 KB
testcase_17 AC 203 ms
94,324 KB
testcase_18 AC 195 ms
94,332 KB
testcase_19 AC 204 ms
94,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P=[float(e)for e in raw_input().split()]
h=[1]*int(N+1)
r=0
for i in range(2,int(N)+1):
	r+=h[i]
	for j in range(i*2,int(N)+1,i):h[j]*=1-P
print(r)
0