結果

問題 No.144 エラトステネスのざる
ユーザー brthyyjpbrthyyjp
提出日時 2021-01-04 06:40:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 237 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 83,956 KB
最終ジャッジ日時 2024-04-22 03:46:41
合計ジャッジ時間 2,900 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,712 KB
testcase_01 AC 38 ms
51,712 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 37 ms
51,712 KB
testcase_04 AC 35 ms
51,840 KB
testcase_05 AC 37 ms
52,352 KB
testcase_06 AC 42 ms
58,240 KB
testcase_07 AC 42 ms
58,368 KB
testcase_08 AC 42 ms
58,496 KB
testcase_09 AC 41 ms
57,984 KB
testcase_10 AC 41 ms
58,240 KB
testcase_11 AC 41 ms
58,240 KB
testcase_12 AC 42 ms
58,324 KB
testcase_13 AC 147 ms
83,372 KB
testcase_14 AC 164 ms
83,640 KB
testcase_15 AC 163 ms
83,456 KB
testcase_16 AC 170 ms
83,584 KB
testcase_17 AC 173 ms
83,956 KB
testcase_18 AC 169 ms
83,584 KB
testcase_19 AC 155 ms
83,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p = map(str, input().split())
n = int(n)
p = float(p)

D = [0]*(n+1)
for i in range(1, n+1):
    j = i
    while i <= n:
        D[i] += 1
        i += j
#print(D)
ans = 0
for i in range(2, n+1):
    ans += (1-p)**(D[i]-2)
print(ans)
0