注:temp可删去,是我犯病加上的()
AC代码:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n, max, min,score,total,temp;
double ave;
total = 0; max = 0; min = 100;
cin >> n;
temp = n;
for(int i=0;i<n;i++)
{
cin >> score;
total += score;
if(score>max)
{
max = score;
}
if (score < min)
{
min = score;
}
}
ave = floor(total / temp);
cout << max << " " << min << " " << ave << endl;
return 0;
}