結果

問題 No.144 エラトステネスのざる
ユーザー pekempey
提出日時 2015-10-06 11:48:06
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 317 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 76,820 KB
実行使用メモリ 102,528 KB
最終ジャッジ日時 2024-07-20 01:42:29
合計ジャッジ時間 5,778 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import random, sys

strs = raw_input().split()
N = int(strs[0])
p = float(strs[1])

d = [0] * (N + 1)

for i in xrange(1, N + 1):
	for j in xrange(i, N + 1, i):
		d[j] += 1

ans = 0.0
for i in xrange(2, N + 1):
	ans += pow(1 - p, d[i] - 2)
print "%.20f" % ans
0