結果

問題 No.144 エラトステネスのざる
ユーザー cielciel
提出日時 2015-02-08 18:11:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 135 bytes
コンパイル時間 1,252 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 92,832 KB
最終ジャッジ日時 2023-09-05 11:00:23
合計ジャッジ時間 4,484 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,316 KB
testcase_01 AC 75 ms
71,312 KB
testcase_02 AC 84 ms
71,440 KB
testcase_03 AC 75 ms
70,996 KB
testcase_04 AC 74 ms
71,108 KB
testcase_05 AC 74 ms
71,276 KB
testcase_06 AC 86 ms
76,472 KB
testcase_07 AC 81 ms
76,580 KB
testcase_08 AC 80 ms
76,508 KB
testcase_09 AC 82 ms
76,460 KB
testcase_10 AC 81 ms
76,444 KB
testcase_11 AC 82 ms
76,576 KB
testcase_12 AC 82 ms
76,572 KB
testcase_13 AC 201 ms
92,536 KB
testcase_14 AC 221 ms
92,652 KB
testcase_15 AC 219 ms
92,572 KB
testcase_16 AC 229 ms
92,576 KB
testcase_17 AC 217 ms
92,640 KB
testcase_18 AC 207 ms
92,516 KB
testcase_19 AC 207 ms
92,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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