QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#506345 | #6423. Fireworks | Abcl | WA | 0ms | 4156kb | C++14 | 714b | 2024-08-05 16:51:26 | 2024-08-05 16:51:27 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
int n,m;
double p;
double ans;
double q(int k){
return ( (double)m+(double)k*n) / ( (double)1.0-pow( (double)1.0-p,k ) );
}
void solve(){
cin>>n>>m>>p; p*=0.0001;
int l=0,r=1e8;
while(l<r){
int mid1=l+(r-l)/3;
int mid2=r-(r-l)/3;
double k1 = q(mid1), k2 = q(mid2);
if(k1<k2){
r=mid2-1;
}
else {
l=mid1+1;
}
}
printf("%.10llf\n",q(l));
return;
}
signed main() {
// ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T_case=1;
cin>>T_case;
while(T_case--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4156kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
-nan -nan -nan
result:
wrong output format Expected double, but "-nan" found