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 |
Memory Limit Exceed?????????????????#include<stdio.h> #include<stdlib.h> #include<iostream.h> int a[5000000]; int comp(const void* a,const void *b) { return *(int*)a-*(int*)b; } int main() { int n1,n2,n; while(scanf("%d%d%d",&n1,&n2,&n)) { if(n1==0&&n2==0&&n==0) { break; } int i; for( i = 0 ; i < n;i++) { scanf("%d",&a[i]); } qsort(a,n,sizeof(int),comp); double sum=0; for(i=n2;i<n-n1;i++) { //cout<<a[i]<<endl; sum+=a[i]; } //cout<<sum<<endl; //printf("%d\n",sum); double ave=sum/(n-n1-n2); printf("%.6lf\n",ave); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator