Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我这样做的怎么错啊!!!!!!!!!!!!哪位好心人帮忙看一下啊!!!!!!不胜感激#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; int a[5000001]; int main() { int n1,n2,n; while(scanf("%d%d%d",&n1,&n2,&n)!=EOF) { if(n1==0&&n2==0&&n==0) break; int b[11],c[11]; for(int i=0;i<11;i++) { b[i]=0;c[i]=100000001; } int i,l,k; int max=0,min=100000001; for(int j=0;j<n;j++) { scanf("%d",&a[j]); if(a[j]>max) { b[0]=a[j]; sort(b,b+n1); max=b[0]; } if(a[j]<min) { c[n2-1]=a[j]; sort(c,c+n2); min=c[n2-1]; } } int sum=0; for(i=0;i<n;i++) sum=sum+a[i]; for(i=0;i<n1;i++) sum=sum-b[i]; for(i=0;i<n2;i++) sum=sum-c[i]; printf("%.6lf\n",(double)sum/(n-n1-n2)); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator