QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#610694 | #2267. Jewelry Size | ucup-team4153# | WA | 1ms | 3860kb | C++20 | 1.8kb | 2024-10-04 16:59:33 | 2024-10-04 16:59:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;using ld=long double;using ll=long long;
using pll=pair<ll,ll>;
const int M=998244353,inv2=(M+1)/2,P=20;const ld eps=1e-8,pi=acos(-1);
ll poww(ll bs,ll x){ll res=1;for(;x;x>>=1,(bs*=bs)%=M)if(x&1)(res*=bs)%=M;return res;}
ll invv(ll bs){return poww(bs,M-2);}
struct S
{
int n,mx=0;vector<int>a;
ld trial2(ld x)
{
ld sum=0;
for(auto&k:a)
{
if(k==mx)sum-=asin(k/x);
else sum+=asin(k/x);
}
return sum;
}
ld trial(ld x)
{
ld sum=0;
for(auto&k:a)
{
if(abs(k-x)<eps)sum+=pi/2;
else if(k>x)return 10;
else sum+=asin(k/x);
}
return sum;
}
void ini()
{
cin>>n;a.resize(n);for(auto&k:a)cin>>k,mx=max(mx,k);
ld sum=trial(mx);if(abs(sum-pi)<eps){cout<<mx<<'\n';return;}
if(sum>pi)
{
//cout<<"A\n";
ld L=mx,R=1e7;
while(R-L>eps)
{
ld x=(L+R)/2,sum=trial(x);
//cout<<x<<'/'<<sum<<'\n';
sum>pi?L=x:R=x;
}
cout<<R/2<<'\n';
}
else
{
ld L=mx,R=1e7;
while(R-L>eps)
{
ld x=(L+R)/2,sum=trial2(x);
//cout<<x<<'/'<<sum<<'\n';
sum<0?L=x:R=x;
}
cout<<R/2<<'\n';
}
}
void solve()
{
}
};
signed main()
{
cout<<fixed<<setprecision(12);
ios::sync_with_stdio(0);
cin.tie(0);
int t=1;//cin>>t;
while(t--){S SS;SS.ini();SS.solve();}
}
/*
1274368 996265816
1807139^
1274369 996265816
1165429^
1274369 996269373
inf^
*/
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3860kb
input:
5 3 1 6 1 7
output:
3.544404351310
result:
ok found '3.5444044', expected '3.5444044', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3732kb
input:
3 500 300 400
output:
500
result:
wrong answer 1st numbers differ - expected: '250.0000000', found: '500.0000000', error = '1.0000000'