#include <iostream>
#include <math.h>
using namespace std;
int main(void)
{
int C = 0;
int N = 0;
cin >> C;
for (int i=0; i<C; i++) // This loop means the number of test case.
{
cin >> N;
if (N>=1 and N<=1000)
{
int Sum = 0;
double Mean = 0;
double count = 0;
double percent = 0;
int Score[N] = {0, };
for (int j=0; j<N; j++) // This loop gets the summation of input values
{
cin >> Score[j];
if (Score[j]< 0 or Score[j]>100)
return 0;
Sum = Sum + Score[j];
}
Mean = Sum / N;
for (int k=0; k<N; k++) // This loop gets count of people who has higher value than mean
{
if (Score[k] > Mean)
{
count = count + 1;
}
}
percent = (count/N) * 100;
cout << fixed;
cout.precision(3);
cout << round(percent * 1000) / 1000 << "%" << endl;
}
}
return 0;
}
'Computer Science > 백준 알고리즘' 카테고리의 다른 글
[백준] 5585번 거스름돈 (파이썬) (0) | 2022.06.16 |
---|---|
[백준] 4673번 셀프 넘버 (C++) (0) | 2022.06.16 |
[백준] 4153번 직각삼각형 (파이썬) (0) | 2022.06.14 |
[백준] 3053번 택시 기하학 (파이썬) (0) | 2022.06.14 |
[백준] 3052번 나머지 (C++) (0) | 2022.06.14 |