Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
134276 | 曾煦翔 | 紧急集合 | C++ | 运行超时 | 60 | 1304 MS | 308 KB | 443 | 2024-03-02 15:20:53 |
#include <bits/stdc++.h> using namespace std; int a[30005]; int main() { // freopen("fruit.in" , "r" , "stdin"); // freopen("fruit.out" , "w", "stdout"); std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; int sum = 0; cin >> n; for(int i = 1;i <= n;i++) cin >> a[i]; for(int i = 2;i <= n;i++) { sort(a + 1 , a + n + 1); a[i] += a[i - 1]; sum += a[i]; } cout << sum; return 0; }