반응형
https://www.acmicpc.net/problem/4344
#include <iostream>
#include <vector>
using namespace std;
int main() {
int testCase, tmp;
vector<int> scores;
cin >> testCase;
while (testCase--) {
int man_cnt, sum = 0, ave = 0, good = 0;
cin >> man_cnt;
scores.reserve(man_cnt);
for (int i = 0; i < man_cnt; i++) {
cin >> tmp;
scores.push_back(tmp);
sum += tmp;
}
ave = (double)sum / man_cnt;
for (int i = 0; i < man_cnt; i++) {
if (scores.at(i) > ave) good++;
}
double point = ((double)good / (double)man_cnt) * 100;
printf("%.3f%%\n", point);
scores.clear();
}
return 0;
}
'Development. > Problem solving.' 카테고리의 다른 글
[BAEKJOON] 5543 - 상근날드 (0) | 2020.10.08 |
---|---|
[BAEKJOON] 5014 - 스타트링크 (0) | 2020.08.17 |
[BAEKJOON] 2839 - 설탕 배달 (0) | 2020.08.17 |
[BAEKJOON] 2753 - 윤년 (0) | 2020.08.17 |
[BAEKJOON] 2751 - 수 정렬하기 2 (0) | 2020.08.17 |