結果

問題 No.144 エラトステネスのざる
ユーザー tktk_snsntktk_snsn
提出日時 2020-06-03 22:02:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 239 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 18,812 KB
最終ジャッジ日時 2024-05-04 14:01:38
合計ジャッジ時間 15,848 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
10,880 KB
testcase_01 AC 24 ms
10,752 KB
testcase_02 AC 24 ms
10,752 KB
testcase_03 AC 24 ms
10,752 KB
testcase_04 AC 24 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 27 ms
10,624 KB
testcase_07 AC 28 ms
10,880 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 25 ms
10,880 KB
testcase_10 AC 26 ms
10,624 KB
testcase_11 AC 25 ms
10,752 KB
testcase_12 AC 26 ms
10,752 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, p = input().split()
N = int(N)
p = int(p.replace(".", "")) / 100000

ans = 0.0
dp = [1] * (N + 1)
for i in range(2, N + 1):
    d = dp[i]
    ans += (1.0 - p) ** (d - 1)
    for x in range(2 * i, N + 1, i):
        dp[x] += 1
print(ans)
0