QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#18210 | #2267. Jewelry Size | Realityang# | WA | 0ms | 6016kb | C++14 | 869b | 2022-01-16 19:51:26 | 2022-05-04 17:20:50 |
Judging History
answer
#include<bits/stdc++.h>
//#define int long long
using namespace std;
const int N=1000010,mod=1e9+7;
const double eps=1e-12;
int n,a[N];
double b[N];
void sun(double r){for(int i=1;i<=n;i++)b[i]=2.0*asin(a[i]*0.5/r);sort(b+1,b+n+1);}
signed main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
}sort(a+1,a+n+1);
double an1=-1,an2=-1;
double ll=a[n]/2.0,rr=1e5;
while(rr-ll>=eps){
double r=(ll+rr)/2.0,su=0;
sun(r);
for(int i=1;i<n;i++)su+=b[i];
double j1=su+b[n]-2.0*acos(-1);
if(j1<0)rr=r;
else if(j1>0)ll=r;
else {an1=r;break;}
}
ll=a[n]/2.0,rr=1e5;
while(rr-ll>=eps){
double r=(ll+rr)/2.0,su=0;
sun(r);
for(int i=1;i<n;i++)su+=b[i];
double j2=b[n]-su;
if(j2<0)rr=r;
else if(j2>0)ll=r;
else {an2=r;break;}
}
if(an1==-1)printf("%.10lf",an2);
if(an2==-1)printf("%.10lf",an1);
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 6016kb
input:
5 3 1 6 1 7
output:
-1.0000000000-1.0000000000
result:
wrong output format Expected double, but "-1.0000000000-1.0000000000" found