编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#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;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:4 ms
内存:420 KiB

输入文件(in1.in

2
1 2

答案文件(in1.out

4.5

用户输出

4.5

系统信息

Exited with return code 0