Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
166801 | 李澄 | 紧急集合 | C++ | 运行超时 | 10 | 1000 MS | 324 KB | 348 | 2024-08-19 15:23:32 |
#include <bits/stdc++.h> using namespace std; typedef long long LL; LL a[10005]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; LL sum = 0; int t = n; while (t > 1) { sort(a + 1, a + t + 1); sum += a[1] + a[2]; a[1] = sum; a[2] = a[t]; t--; } cout << sum << endl; return 0; }