| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 42117 | 氩_wjy | 【S】T2 | C++ | 通过 | 100 | 259 MS | 15908 KB | 1128 | 2026-06-13 14:48:39 |
#include<bits/stdc++.h> #define int long long #define ull unsigned long long #define i128 __int128_t #define doub long double #define PII pair<int,int> #define fir first #define sec second #define lb(x) ((x)&(-(x))) #define ctz __builtin_ctzll #define clz __builtin_clzll #define PC __builtin_popcountll #define lc(p) ((p)<<1) #define rc(p) ((p)<<1|1) #define FL() fflush(stdout) // #define endl '\n' using namespace std; const int N=5e5+7,mod=998244353; int n; doub p[N],a[N]; signed main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #ifndef ONLINE_JUDGE freopen("1.in","r",stdin); freopen("1.out","w",stdout); #endif cin>>n; for(int i=1;i<=n;i++)cin>>p[i]; for(int i=1;i<=n;i++){ if(p[i]==1){ cout<<1<<endl; return 0; }a[i]=p[i]/(1-p[i]); } sort(a+1,a+n+1,greater<doub>()); doub S=0,P=1; doub Ans=0; for(int i=1;i<=n;i++){ // cout<<a[i]<<" "<<S<<" "<<P<<endl; S+=a[i];P*=(1+a[i]); Ans=max(Ans,S/P); } cout<<fixed<<setprecision(18)<<Ans<<endl; return 0; }