AcWing 1227. 成绩分析
作者:
cocoonnnp
,
2022-03-19 11:50:52
,
所有人可见
,
阅读 172
//原题:http://lx.lanqiao.cn/problem.page?gpid=T2853
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const int N=10010;
int a[N];
double fun(double res,int n){
int t=(int)(res*pow(10,n)+0.5);
res=t*1.0/pow(10,n);
return res;
}
int main(){
int n,max_num=0,min_num=999999,sum=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
min_num=min(min_num,a[i]);
max_num=max(max_num,a[i]);
sum+=a[i];
}
double res=sum*1.0/n;
cout<<max_num<<endl;
cout<<min_num<<endl;
printf("%.2lf",fun(res,2));
return 0;
}