結果

問題 No.144 エラトステネスのざる
ユーザー daku9640daku9640
提出日時 2017-02-21 09:16:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 243 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 49,320 KB
最終ジャッジ日時 2023-08-28 22:13:34
合計ジャッジ時間 4,012 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,864 KB
testcase_01 AC 15 ms
7,872 KB
testcase_02 AC 15 ms
7,928 KB
testcase_03 AC 16 ms
7,944 KB
testcase_04 AC 16 ms
7,792 KB
testcase_05 AC 15 ms
7,904 KB
testcase_06 AC 16 ms
7,892 KB
testcase_07 AC 16 ms
7,824 KB
testcase_08 AC 16 ms
7,872 KB
testcase_09 AC 16 ms
7,808 KB
testcase_10 AC 16 ms
7,868 KB
testcase_11 AC 16 ms
7,852 KB
testcase_12 AC 17 ms
7,984 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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