QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#17993#2267. Jewelry Size_silhouette_#WA 1ms3764kbC++827b2022-01-15 16:49:212022-05-04 16:36:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-04 16:36:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3764kb
  • [2022-01-15 16:49:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int Max_N=1e3;
int n,L[Max_N+5];
bool chck(long double x){
	long double sum=0;
	for(int i=1;i<n;i++)
	 sum+=acos(1.0-(1.0*L[i]*L[i])/(2.0*x*x));
	return sum>=acos(1.0-(1.0*L[n]*L[n])/(2.0*x*x));
}
bool CHCK(long double x){
	long double sum=0;
	for(int i=1;i<=n;i++)
	 sum+=acos(1.0-(1.0*L[i]*L[i])/(2.0*x*x));
	return sum<=2*acos(-1.0);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&L[i]);
	sort(L+1,L+n+1);
	long double l=0,r=1e9;
	for(;fabs(r-l)>=(1e-8);){
		long double mid=(l+r)/2;
		if(chck(mid)) r=mid;
		else l=mid;
	}
	if(chck(r)){
		printf("%.8Lf\n",r);
		return 0;
	}
	l=0,r=1e9;
	for(;fabs(r-l)>=(1e-8);){
		long double mid=(l+r)/2;
		if(CHCK(mid)) r=mid;
		else l=mid;
	}
	printf("%.8Lf\n",l);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
3 1 6 1 7

output:

3.50000001

result:

wrong answer 1st numbers differ - expected: '3.5444044', found: '3.5000000', error = '0.0125280'