結果

問題 No.144 エラトステネスのざる
ユーザー H3PO4H3PO4
提出日時 2020-05-06 11:14:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 718 ms
コンパイル使用メモリ 86,688 KB
実行使用メモリ 93,164 KB
最終ジャッジ日時 2023-09-10 20:07:13
合計ジャッジ時間 4,739 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,348 KB
testcase_01 AC 72 ms
71,096 KB
testcase_02 AC 72 ms
71,420 KB
testcase_03 AC 70 ms
71,284 KB
testcase_04 AC 72 ms
71,248 KB
testcase_05 AC 72 ms
71,288 KB
testcase_06 AC 84 ms
76,040 KB
testcase_07 AC 75 ms
76,668 KB
testcase_08 AC 76 ms
76,376 KB
testcase_09 AC 76 ms
76,368 KB
testcase_10 AC 77 ms
76,436 KB
testcase_11 AC 77 ms
76,520 KB
testcase_12 AC 76 ms
76,288 KB
testcase_13 AC 190 ms
92,544 KB
testcase_14 AC 238 ms
92,972 KB
testcase_15 AC 244 ms
92,992 KB
testcase_16 AC 244 ms
93,164 KB
testcase_17 AC 248 ms
92,956 KB
testcase_18 AC 242 ms
92,984 KB
testcase_19 AC 214 ms
92,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, P = input().split()
N = int(N)
P = float(P)

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

ans = .0
for x in factor[2:]:
    ans += (1 - P) ** x
print(ans)
0