QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#17993 | #2267. Jewelry Size | _silhouette_# | WA | 1ms | 3764kb | C++ | 827b | 2022-01-15 16:49:21 | 2022-05-04 16:36:06 |
Judging History
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'