結果

問題 No.144 エラトステネスのざる
ユーザー kutsutamakutsutama
提出日時 2019-02-14 13:16:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 212 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 49,316 KB
最終ジャッジ日時 2023-10-11 12:33:20
合計ジャッジ時間 4,291 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
14,916 KB
testcase_01 AC 16 ms
7,924 KB
testcase_02 AC 16 ms
7,908 KB
testcase_03 AC 16 ms
7,892 KB
testcase_04 AC 16 ms
7,900 KB
testcase_05 AC 16 ms
8,064 KB
testcase_06 AC 17 ms
7,924 KB
testcase_07 AC 17 ms
7,920 KB
testcase_08 AC 17 ms
7,912 KB
testcase_09 AC 17 ms
7,956 KB
testcase_10 AC 17 ms
7,952 KB
testcase_11 AC 17 ms
8,020 KB
testcase_12 AC 16 ms
7,964 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

s = input().split()
n = int(s[0])
p = float(s[1])

can = [1.0] * (n + 1)
pi = 1 - p
for k in range(2, n + 1):
    for i in range(k + k, n + 1, k):
        can[i] *= pi
res = sum(can[2:])

print(res)
0