QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#506345#6423. FireworksAbclWA 0ms4156kbC++14714b2024-08-05 16:51:262024-08-05 16:51:27

Judging History

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

  • [2024-08-05 16:51:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4156kb
  • [2024-08-05 16:51:26]
  • 提交

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