結果

問題 No.144 エラトステネスのざる
ユーザー nbisconbisco
提出日時 2017-01-28 20:48:04
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 93,132 KB
最終ジャッジ日時 2023-08-25 13:24:42
合計ジャッジ時間 3,739 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
70,904 KB
testcase_01 AC 65 ms
71,172 KB
testcase_02 AC 66 ms
71,284 KB
testcase_03 AC 69 ms
70,996 KB
testcase_04 AC 64 ms
70,836 KB
testcase_05 AC 61 ms
70,820 KB
testcase_06 AC 65 ms
76,120 KB
testcase_07 AC 64 ms
76,412 KB
testcase_08 AC 66 ms
76,616 KB
testcase_09 AC 64 ms
76,408 KB
testcase_10 AC 63 ms
76,676 KB
testcase_11 AC 63 ms
76,176 KB
testcase_12 AC 66 ms
76,236 KB
testcase_13 AC 177 ms
92,460 KB
testcase_14 AC 193 ms
93,108 KB
testcase_15 AC 201 ms
92,892 KB
testcase_16 AC 198 ms
92,848 KB
testcase_17 AC 204 ms
92,836 KB
testcase_18 AC 204 ms
93,132 KB
testcase_19 AC 182 ms
92,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

count = [0] * (N+1)
for i in range(2, N//2+1):
    for j in range(2*i, N+1, i):
        count[j] += 1

ans = 0.0
for i in count[2:]:
    ans += p ** i
print(ans)
0