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