백준 4344

4810 단어 bojboj

백준 4344

#include<iostream>
#include<vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int n2;
        cin >> n2;
        int cnt = 0;
        double sum = 0;
        int tmp;
        vector<int> v1;
        for (int j = 0; j < n2; j++)
        {
            cin >> tmp;
            sum += tmp;
            v1.push_back(tmp);
        }
        double ave = sum / static_cast<double>(n2);
        for (auto j : v1)
            if (j > ave)
                cnt++;
        sum = cnt * 100 / static_cast<double>(n2);
        printf("%.3f%%\n",sum);

    }
}

좋은 웹페이지 즐겨찾기