QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#17901#2267. Jewelry SizeJohnAlfnov#WA 3ms4220kbC++14648b2022-01-15 09:28:242022-05-04 16:17:34

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:17:34]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4220kb
  • [2022-01-15 09:28:24]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int a[1005];
double x[1005];
const double pi=acos(-1);
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	double l1=0,r1=1e7;
	while(r1-l1>1e-8){
		double mid=(l1+r1)/2,he=0;
		for(int i=1;i<=n;++i){
			x[i]=acos(1-1/2.0*a[i]*a[i]/mid/mid);
			he+=x[i];
		}
		if(he<2*pi)r1=mid;
		else l1=mid;
	}
	double l2=0,r2=1e7;
	while(r2-l2>1e-8){
		double mid=(l2+r2)/2,he=0,mx=0;
		for(int i=1;i<=n;++i){
			x[i]=acos(1-1/2.0*a[i]*a[i]/mid/mid);
			he+=x[i],mx=max(mx,x[i]);
		}
		if(he<2*mx)r2=mid;
		else l2=mid;
	}
	printf("%.8f\n",min(l1,l2));
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 4220kb

input:

5
3 1 6 1 7

output:

3.54440434

result:

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

Test #2:

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

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: 4212kb

input:

8
2000 3000 4000 2000 3000 4000 2000 3000

output:

3780.97412059

result:

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

Test #4:

score: -100
Wrong Answer
time: 3ms
memory: 4152kb

input:

10
602 67 67 67 67 67 67 67 67 67

output:

300.99999999

result:

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