結果

問題 No.144 エラトステネスのざる
ユーザー sue_charosue_charo
提出日時 2017-04-17 13:12:45
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 195 bytes
コンパイル時間 2,650 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 92,532 KB
最終ジャッジ日時 2023-09-26 10:36:23
合計ジャッジ時間 3,571 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,100 KB
testcase_01 AC 73 ms
71,192 KB
testcase_02 AC 85 ms
71,348 KB
testcase_03 AC 74 ms
70,848 KB
testcase_04 AC 73 ms
71,184 KB
testcase_05 AC 74 ms
71,160 KB
testcase_06 AC 78 ms
75,824 KB
testcase_07 AC 77 ms
76,132 KB
testcase_08 AC 75 ms
76,172 KB
testcase_09 AC 78 ms
76,296 KB
testcase_10 AC 76 ms
76,424 KB
testcase_11 AC 76 ms
76,080 KB
testcase_12 AC 77 ms
76,164 KB
testcase_13 AC 164 ms
92,468 KB
testcase_14 AC 154 ms
92,532 KB
testcase_15 AC 152 ms
92,436 KB
testcase_16 AC 155 ms
92,464 KB
testcase_17 AC 156 ms
92,320 KB
testcase_18 AC 169 ms
92,500 KB
testcase_19 AC 161 ms
92,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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