QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691323#6423. Fireworksyzj123#WA 1ms4124kbC++201013b2024-10-31 10:57:442024-10-31 10:57:55

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 10:57:55]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4124kb
  • [2024-10-31 10:57:44]
  • 提交

answer

#include<bits/stdc++.h>
using i64 = long long;
#define int i64
void solve() {
    int n, m, p;
    std::cin >> n >> m >> p;
    double P = (double)p / 10000;
    int l = 1, r = 1e9, ans;
    auto work = [&](int t) -> double {
        double U = (n * t + m);
        double D = (1.0 - std::pow(1.0 - P, t));
        // printf("%d :  %.10lf, %.10lf, %.10lf\n", t, U, D, U / D);
        return U / D;
    };
    while (r - l > 2) {
        int lmid = l + (r - l) / 3;
        int rmid = r - (r - l) / 3;
        if (work(lmid) > work(rmid)) {
            l = lmid + 1;
            ans = rmid;
        } else {
            r = rmid - 1;
            ans = lmid;
        }
    }
    double res = work(1);
    res = std::min(res, work(ans));
    printf("%.10lf", res);
}
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t = 1;
    std::cin >> t;
    while (t --) {
        solve();
    }
    return 0;
}
/*
3
1 1 5000
1 1 1
1 2 10000
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4124kb

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.000000000010141.58528911473.0000000000

result:

wrong output format Expected double, but "4.000000000010141.58528911473.0000000000" found