QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#18210#2267. Jewelry SizeRealityang#WA 0ms6016kbC++14869b2022-01-16 19:51:262022-05-04 17:20:50

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 17:20:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:6016kb
  • [2022-01-16 19:51:26]
  • 提交

answer

#include<bits/stdc++.h>
//#define int long long
using namespace std;
const int N=1000010,mod=1e9+7;
const double eps=1e-12;
int n,a[N];
double b[N];
void sun(double r){for(int i=1;i<=n;i++)b[i]=2.0*asin(a[i]*0.5/r);sort(b+1,b+n+1);}
signed main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}sort(a+1,a+n+1);
	double an1=-1,an2=-1;
	double ll=a[n]/2.0,rr=1e5;
	while(rr-ll>=eps){
		double r=(ll+rr)/2.0,su=0;
		sun(r);
		for(int i=1;i<n;i++)su+=b[i];
		double j1=su+b[n]-2.0*acos(-1);
		if(j1<0)rr=r;
		else if(j1>0)ll=r;
		else {an1=r;break;}
	}
	ll=a[n]/2.0,rr=1e5;
	while(rr-ll>=eps){
		double r=(ll+rr)/2.0,su=0;
		sun(r);
		for(int i=1;i<n;i++)su+=b[i];
		double j2=b[n]-su;
		if(j2<0)rr=r;
		else if(j2>0)ll=r;
		else {an2=r;break;}
	}
	if(an1==-1)printf("%.10lf",an2);
	if(an2==-1)printf("%.10lf",an1);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 6016kb

input:

5
3 1 6 1 7

output:

-1.0000000000-1.0000000000

result:

wrong output format Expected double, but "-1.0000000000-1.0000000000" found