C++ 台中區 106-1 計算多個整數的平均值、最大值、最小值

#include<iostream>
#include<cstdio>
using namespace std;
#define INF 1000000000

long long round(long long a){
    return (a+5)/10;
}

int main(){
    long long n,sum=0,mx=-INF,mn=INF,t;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>t;
        mx=max(mx,t);
        mn=min(mn,t);
        sum+=t;
    }
    long long aver=round(sum*1000/n);
    cout<<aver/100<<".";
    printf("%02lld\n",aver%100);
    cout<<mx<<"\n"<<mn<<"\n";
    return 0;
}