QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#18174 | #2267. Jewelry Size | Wu_Ren# | WA | 61ms | 3724kb | C++11 | 762b | 2022-01-16 16:57:09 | 2022-05-04 17:15:50 |
Judging History
answer
#include<bits/stdc++.h>
int mod;
const long double pi=acos(-1);
using namespace std;
int n,m,K;
int a[1000010];
char s[1000010];
long double ans,res=1e18,d;
bool chk(long double x,int k){
long double sum=0,t=2*x*x;
for(int i=1;i<n;i++) sum+=acosl(1-a[i]/t);
if(k) sum+=acosl(1-a[n]/t);
else sum+=2*pi-acosl(1-a[n]/t);
if(fabsl(sum-2*pi)<=1e-3) ans=x;
return sum<2*pi;
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
sort(a+1,a+n+1),d=a[n]/2.0;
for(int i=1;i<=n;i++) a[i]=a[i]*a[i];
for(int k=0;k<2;k++){
ans=1e18;
long double l=d,r=1e10,mid;
for(int _=0;_<100000;_++){
mid=(l+r)/2;
if(chk(mid,k)) (k?r:l)=mid;
else (k?l:r)=mid;
}
res=min(res,ans);
}
printf("%.12lf",res);
}
详细
Test #1:
score: 0
Wrong Answer
time: 61ms
memory: 3724kb
input:
5 3 1 6 1 7
output:
0.000000000000
result:
wrong answer 1st numbers differ - expected: '3.5444044', found: '0.0000000', error = '1.0000000'