QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#17988#2267. Jewelry Size_silhouette_#WA 2ms3860kbC++827b2022-01-15 16:35:022022-05-04 16:35:35

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:35:35]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3860kb
  • [2022-01-15 16:35:02]
  • 提交

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<=2*acos(-1.0);
}
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));
}
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: 100
Accepted
time: 1ms
memory: 3844kb

input:

5
3 1 6 1 7

output:

3.54440435

result:

ok found '3.5444044', expected '3.5444044', error '0.0000000'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3860kb

input:

3
500 300 400

output:

250.00000000

result:

ok found '250.0000000', expected '250.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3760kb

input:

8
2000 3000 4000 2000 3000 4000 2000 3000

output:

3780.97412061

result:

ok found '3780.9741206', expected '3780.9741206', error '0.0000000'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3772kb

input:

10
602 67 67 67 67 67 67 67 67 67

output:

301.00000000

result:

wrong answer 1st numbers differ - expected: '3003.1398170', found: '301.0000000', error = '0.8997716'