結果

問題 No.144 エラトステネスのざる
ユーザー daku9640daku9640
提出日時 2017-02-21 09:16:52
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 243 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 92,920 KB
最終ジャッジ日時 2023-08-28 22:16:42
合計ジャッジ時間 3,744 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,304 KB
testcase_01 AC 69 ms
71,308 KB
testcase_02 AC 70 ms
71,676 KB
testcase_03 AC 72 ms
71,048 KB
testcase_04 AC 74 ms
71,652 KB
testcase_05 AC 74 ms
71,640 KB
testcase_06 AC 78 ms
76,488 KB
testcase_07 AC 76 ms
76,520 KB
testcase_08 AC 76 ms
76,544 KB
testcase_09 AC 75 ms
76,540 KB
testcase_10 AC 76 ms
76,668 KB
testcase_11 AC 77 ms
76,516 KB
testcase_12 AC 78 ms
76,504 KB
testcase_13 AC 158 ms
92,796 KB
testcase_14 AC 158 ms
92,732 KB
testcase_15 AC 159 ms
92,616 KB
testcase_16 AC 163 ms
92,708 KB
testcase_17 AC 159 ms
92,732 KB
testcase_18 AC 163 ms
92,704 KB
testcase_19 AC 156 ms
92,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-

tmp = input().split(" ")
N = int(tmp[0])
p = 1.0 - float(tmp[1])

dp = [1.0] * (N + 1)
for i in range(2, N // 2 + 1):
    for j in range(2, N // i + 1):
        dp[i * j] *= p;
print(sum(dp[2:]))
0