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 |
Re:Memory Limit Exceed?????????????????In Reply To:Re:Memory Limit Exceed????????????????? Posted by:Eli_love at 2009-06-27 21:51:38 #include<iostream> using namespace std; __int64 a[5000003]; void qsort(int l,int r) { int i,j,x; i=l;j=r;x=a[(i+j)>>1]; while(i<=j) { while(a[i]<x) i++; while(a[j]>x) j--; if(i<=j) { int t; t=a[i];a[i]=a[j];a[j]=t; i++;j--; } } if(i<r) qsort(i,r); if(j>l) qsort(l,j); } int main() { int n1,n2,n,i; double sum; while(scanf("%d%d%d",&n1,&n2,&n)) { if(n1==0 && n2==0 && n==0) break; sum=0.0; for(i=1;i<=n;i++) scanf("%I64d",&a[i]); qsort(1,n); for(i=n2+1;i<=n-n1;i++) sum+=a[i]; sum=sum/(n-n1-n2); printf("%.6lf\n",sum); } return 0; } 一样MLE!!!!!!!! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator