Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
28467 | baka24 | 【BJ】T1 | C++ | 运行出错 | 0 | 0 MS | 256 KB | 663 | 2024-04-14 18:36:37 |
#include<bits/stdc++.h> #define int long long #define doub long double using namespace std; const int maxn=1e6+7; int n; int a[maxn]; int tmp[maxn]; signed main(){ freopen("drink.in","r",stdin); freopen("drink.out","w",stdout); cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; doub ans=0; for(int l=n;l>=1;l--){ for(int r=l;r<=n;r++){ tmp[r]=a[r]; int t=r; while(tmp[t-1]>tmp[t])swap(tmp[t-1],tmp[t]),t--; doub f=0; for(int i=l;i<=r;i++){ f=(f+tmp[i])/2; } ans+=f; } } cout<<ans*1.0/(n*n)<<endl; }