标签:策略 force code 简单的 可变 ons 比赛 固定 bre
#include <cstdio>
#include <algorithm>
using std::sort;
using std::max;
const int maxn = 105;
int n, a[maxn];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
sort(a + 1, a + 1 + n);
int now = 10, ans = 0, penalty = 0;
for (int i = 1; i <= n; i++) {
if (now + a[i] > 720) break;
ans++;
now += a[i];
penalty += max(0, now - 360);
}
return !printf("%d %d\n", ans, penalty);
}
标签:策略 force code 简单的 可变 ons 比赛 固定 bre
原文地址:https://www.cnblogs.com/AlphaWA/p/10895741.html