結果

問題 No.144 エラトステネスのざる
ユーザー cielciel
提出日時 2015-02-08 18:06:19
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 185 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 238,352 KB
最終ジャッジ日時 2023-09-05 15:48:40
合計ジャッジ時間 18,867 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,576 KB
testcase_01 AC 96 ms
71,728 KB
testcase_02 AC 97 ms
71,648 KB
testcase_03 AC 97 ms
71,740 KB
testcase_04 AC 95 ms
71,584 KB
testcase_05 AC 97 ms
71,748 KB
testcase_06 AC 109 ms
77,556 KB
testcase_07 AC 107 ms
77,732 KB
testcase_08 AC 104 ms
77,624 KB
testcase_09 AC 106 ms
78,040 KB
testcase_10 AC 106 ms
77,708 KB
testcase_11 AC 106 ms
78,024 KB
testcase_12 AC 105 ms
77,628 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict as D
N,P=[float(e)for e in input().split()]
h=D(lambda: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