• poj2350


    简单题

    #include <iostream>
    #include <cstdlib>
    #include <cstdio>
    #include <cstring>
    using namespace std;
    
    #define maxn 1005
    
    int n;
    int f[maxn];
    double average;
    
    void input()
    {
        int sum = 0;
        scanf("%d", &n);
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &f[i]);
            sum += f[i];
        }
        average = sum * 1.0 / n;
    }
    
    double work()
    {
        int num = 0;
        for (int i = 0; i < n; i++)
            if (f[i] > average)
                num++;
        return num * 100.0 / n;
    }
    
    int main()
    {
        int t;
        scanf("%d", &t);
        while (t--)
        {
            input();
            printf("%.3f%%\n", work());
        }
        return 0;
    }
    View Code
  • 相关阅读:
    Shiro
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    Java
    Java
    Java
  • 原文地址:https://www.cnblogs.com/rainydays/p/3125217.html
Copyright © 2020-2023  润新知