solution.cpp 428 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <stdio.h>
#include <iostream>

using namespace std;
int main()
{
    int n;
    cin >> n;
    int sum = 0;
    int top = 0;
    int low = 100;

    int score;
    for (int i = 0; i < n; i++)
    {
        cin >> score;
        if (score > top)
            top = score;
        if (score < low)
            low = score;
        sum += score;
    }
    printf("%d\n%d\n%.2lf", top, low, (sum * 1.0 / n));
    return 0;
}