QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#18185 | #2267. Jewelry Size | Appleblue17# | WA | 4ms | 4276kb | C++ | 932b | 2022-01-16 17:20:45 | 2022-05-04 17:18:02 |
Judging History
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(){
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=200000;
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=200000;
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: 100
Accepted
time: 3ms
memory: 4276kb
input:
5 3 1 6 1 7
output:
3.5444043468
result:
ok found '3.5444043', expected '3.5444044', error '0.0000000'
Test #2:
score: 0
Accepted
time: 3ms
memory: 4052kb
input:
3 500 300 400
output:
250.0000000000
result:
ok found '250.0000000', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 3ms
memory: 4036kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.9741205946
result:
ok found '3780.9741206', expected '3780.9741206', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4152kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
3003.1398169635
result:
ok found '3003.1398170', expected '3003.1398170', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 4ms
memory: 4168kb
input:
1000 4719 3755 2542 1190 5557 3641 5426 1578 5247 3181 3524 983 4151 4337 3004 2062 1048 4739 499 2530 1378 450 5459 651 1714 4051 416 4186 2598 1031 374 5523 4787 1122 4919 2549 4763 4345 2333 4009 5732 5857 3198 3882 2399 4409 4151 3447 1353 4650 4184 2731 3307 3642 3383 5021 5899 2005 3206 702 30...
output:
199999.9999999944
result:
wrong answer 1st numbers differ - expected: '490696.1297935', found: '200000.0000000', error = '0.5924158'