QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#691323 | #6423. Fireworks | yzj123# | WA | 1ms | 4124kb | C++20 | 1013b | 2024-10-31 10:57:44 | 2024-10-31 10:57:55 |
Judging History
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