noip2012 阅读程序1
#include<cstdio>#include<cstring>#include<math.h>#include<stdlib.h>#include<algorithm>#include<ctime>#include<iostream>using namespace std;const int maxn=1000;int n,i,temp,sum,a[100];int main(){#ifndef ONLINE_JUDGE freopen("in.txt","r",stdin);#endifint i,j;cin>>n;for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n-1;i++) if(a[i]>a[i+1]) { temp=a[i]; a[i]=a[i+1]; a[i+1]=temp; } for(i=n;i>=2;i--) if(a[i]<a[i-1]) { temp=a[i]; a[i]=a[i-1]; a[i-1]=temp; } sum=0; for(i=2;i<=n-1;i++) sum+=a[i]; cout<<sum/(n-2)<<endl;//printf("%.2lf\n",(double)clock()/CLOCKS_PER_SEC); return 0;}/**/