QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#616151 | #2267. Jewelry Size | asdfsdf# | WA | 1ms | 3952kb | C++23 | 1.2kb | 2024-10-05 22:51:37 | 2024-10-05 22:51:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define MAX 1010101
#define PI 3.1415926535897943383
int X[MAX];
typedef long double ld;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int N;
cin>>N;
int i;
int mx = 0;
for(i=1;i<=N;i++) cin>>X[i],mx = max(mx, X[i]);
sort(X+1, X+N+1);
ld t=0;
for(i=1;i<N;i++) {
t += asin((ld)X[i]/((ld)2*(ld)X[N]));
}
ld l, r;
l = mx;
if(t<PI) {
l = X[N];
l*=0.5;
r= 1e8;
int T = 5000;
while(T--){
ld m = l+r;
m/=2.0;
//cout<<l<<' '<<r<<'\n';
ld t=0;
for(i=1;i<=N;i++) {
t += asin(X[i]/(2*m));
}
if(t<PI) r=m;
else l=m;
}
}
else{
l = X[N];
l*=0.5;
r= 1e8;
int T = 5000;
while(T--){
ld m = l+r;
m/=2.0;
//cout<<l<<' '<<r<<'\n';
ld t=0;
for(i=1;i<N;i++) {
t += asin(X[i]/(2*m));
}
if(t<asin(X[N]/(2*m))) l=m;
else r=m;
}
}
cout<<fixed;
cout.precision(20);
cout<<l;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3936kb
input:
5 3 1 6 1 7
output:
3.54440435091866091533
result:
ok found '3.5444044', expected '3.5444044', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
3 500 300 400
output:
250.00000000000000000000
result:
ok found '250.0000000', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3952kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.97412059948717355518
result:
ok found '3780.9741206', expected '3780.9741206', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3868kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
301.00000000000000000000
result:
wrong answer 1st numbers differ - expected: '3003.1398170', found: '301.0000000', error = '0.8997716'