AcWing 5474. 平均成绩
原题链接
中等
作者:
Agoni7z
,
2024-03-03 22:12:59
,
所有人可见
,
阅读 27
#include "bits/stdc++.h"
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
double sum = 0;
int cnt = 0;
for (int i = 0; i < n; i ++) {
cin >> a[i];
sum += a[i];
}
if (sum / n + 0.5 >= 5.0) printf("0\n");
else {
sort(a.begin(), a.end());
for (int i = 0; i < n; i ++) {
cnt ++;
int x = 5 - a[i];
sum += x;
if (sum / n + 0.5 >= 5.0) {
printf("%d", cnt);
return 0;
}
}
}
}