用户输出
4.5
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#49348 | #1284. diana的零食宝库 | Accepted | 100 | 4 ms | 420 K | C++ 11 / 448 B | 丸山彩 | 2021-06-28 21:38:04 |
#include "bits/stdc++.h"
#define ls (i << 1)
#define rs ((i << 1) + 1)
using namespace std;
typedef long long ll;
double a[100010];
double tot = 0, ans = 0;
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%lf", &a[i]);
}
sort(a, a + n);
for (int i = n - 1; i >= 0; i--) {
tot += a[i];
ans = max(ans, tot * tot / (n - i));
}
cout << ans;
return 0;
}