QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#18186#2267. Jewelry SizeAppleblue17#WA 1ms3880kbC++969b2022-01-16 17:21:352022-05-04 17:18: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 17:18:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3880kb
  • [2022-01-16 17:21:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1100;
const double PI=acos(-1),eps=1e-8;
int n;
int a[N],mx;


int main(){
	freopen("tests_5.in","r",stdin);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	mx=a[n];
	
	double l,r,ans1,ans2,del1,del2,tot;
	l=mx/2.0,r=1000000;
	while(r-l>eps){
		double mid=(l+r)/2,tot=0;
		for(int i=1;i<=n;i++) tot+=asin(a[i]*1.0/2/mid);
		if(tot<PI) r=mid;
		else l=mid;
	}
	ans1=l;
	tot=0;
	for(int i=1;i<=n;i++) tot+=asin(a[i]*1.0/2/ans1);
	del1=fabs(tot-PI);
	
	
	l=mx/2.0,r=1000000;
	while(r-l>eps){
		double mid=(l+r)/2,tot=0;
		for(int i=1;i<n;i++) tot+=asin(a[i]*1.0/2/mid);
		if(tot<asin(mx*1.0/2/mid)) l=mid;
		else r=mid;
	}
	ans2=l;
	tot=0;
	for(int i=1;i<n;i++) tot+=asin(a[i]*1.0/2/ans2);
	del2=fabs(tot-asin(mx*1.0/2/ans2));
	
//	cout<<ans1<<" "<<ans2<<endl;
	if(del1<del2) cout<<setprecision(10)<<fixed<<ans1;
	else cout<<setprecision(10)<<fixed<<ans2;
}

详细

Test #1:

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

input:

5
3 1 6 1 7

output:

0.0000000000

result:

wrong answer 1st numbers differ - expected: '3.5444044', found: '0.0000000', error = '1.0000000'