QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#17901 | #2267. Jewelry Size | JohnAlfnov# | WA | 3ms | 4220kb | C++14 | 648b | 2022-01-15 09:28:24 | 2022-05-04 16:17:34 |
Judging History
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'