Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

5555555555555555555555555555555555555555555555555555555555555555555555555555555555

Posted by ecjtuwh at 2006-10-15 20:38:00 on Problem 2833
#include<iostream>
#include<iomanip>
#include<stdlib.h>
#define N 500002
using namespace std;
int fun(const void *a,const void *b)
   {return *(int*)a-*(int *)b;}
int main()
{double t;
 int i,j,m,n,p,sum;
 int a[N];
 while(1)
 {sum=0;
 cin>>m>>n>>p;
 if(m+n+p==0) break;
 for(i=1;i<=p;i++)
   {cin>>a[i];sum+=a[i];}
 qsort(a+1,p,4,fun);
   for(i=1;i<=n;i++)
     sum-=a[i];
   for(int t=1,j=p;t<=m;t++,j--)
     sum-=a[j];
   p=p-m-n;
   t=double(sum)/p;
   cout<<setprecision(6);
   cout<<fixed<<t<<endl;
 }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator