QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#17988 | #2267. Jewelry Size | _silhouette_# | WA | 2ms | 3860kb | C++ | 827b | 2022-01-15 16:35:02 | 2022-05-04 16:35:35 |
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<=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'