QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624953 | #6423. Fireworks | lir_nut | WA | 1ms | 3932kb | C++14 | 1.2kb | 2024-10-09 16:59:42 | 2024-10-09 16:59:43 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <set>
#define test
#ifndef test
freopen("in.in", stdin);
#endif
#define rint register int
#define ll long long
#define P pair<int, int>
const int N = 2e5+5;
using namespace std;
int n, m, p;
long double qpow(long double a, int x){
long double ans = 1;
while(x){
if(x&1) ans*=a;
a*=a;
x>>=1;
}
return ans;
}
long double val(int k){
long double ans = 1 - qpow(1-(long double)p/10000, k);
ans /= (n * k + m);
return ans;
}
void solution(){
scanf("%d%d%d", &n, &m, &p);
int l = 1, r = 2e9, eps = 1, lm, rm, mid;
while(r - l > eps){
mid = (l + r) / 2;
lm = mid - eps;
rm = mid + eps;
if(val(lm) < val(rm)) l = mid;
else r = mid;
}
long double ans = max(max(val(max(l-1, 1)), val(l)), max(val(l+1), val(l+2)));
ans = val(2);
printf("%.10lf", (double)(1/ans));
}
int main(){
test
int t = 1;
scanf("%d", &t);
while (t--){
solution();
if(t) printf("\n");
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3932kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
4.0000000000 15000.7500375019 4.0000000000
result:
wrong answer 2nd numbers differ - expected: '10141.58529', found: '15000.75004', error = '0.47913'