#include <iostream>
#include <iomanip>

int main() {
    int n;
    double p;
    std::cin >> n >> p;

    double ans = 0;
    for (int i = 0; i < n; i++) {
        ans += 1.0 / (1 + i * (1 - p));
    }

    std::cout << std::fixed << std::setprecision(3) << ans << std::endl;

    return 0;
}

原文地址: https://www.cveoy.top/t/topic/ifPl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录