标签:style blog class code c java
1 #include <iostream> 2 #include <iomanip> 3 using namespace std; 4 5 int main() 6 { 7 int n; 8 double max,min,sum,aver; 9 double a[110] = {0}; 10 while (cin >> n) 11 { 12 for (int i = 0; i<n; i++) 13 { 14 cin >> a[i]; 15 } 16 max = min = a[0]; 17 sum = 0; 18 for (int i = 0; i<n; i++) 19 { 20 if (a[i]<=min) 21 { 22 min = a[i]; 23 } 24 if (a[i]>=max) 25 { 26 max = a[i]; 27 } 28 sum += a[i]; 29 } 30 aver = (double)(sum-max-min)/(n-2); 31 cout<<setprecision(2)<< setiosflags(ios::fixed)<< aver <<endl; 32 } 33 return 0; 34 }
标签:style blog class code c java
原文地址:http://www.cnblogs.com/lingc/p/3725087.html