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 |
挺简单的题一直waaaaaaaaaaa ,我测了好多数据了,哪错了啊啊啊啊啊#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<functional> using namespace std; int main() { int sml[15],big[15]; int n1,n2,n; int large; int i,j,k; int t; long long sum; while(1) { scanf("%d %d %d",&n1,&n2,&n); if(0 == n1 && 0 == n2 && 0 == n) break; sum = 0; large = max(n1,n2); for(i=0;i<large;i++) { scanf("%d",&t); sum += t; sml[i] = t; big[i] = t; } sort(sml,sml + large,greater<int>()); sort(big,big + large,less<int>()); make_heap(sml,sml + n1,greater<int>()); make_heap(big,big + n2,less<int>()); for(i=large;i<n;i++) { scanf("%d",&t); sum += t; if( t > sml [0]) { sml[0] = t; make_heap(sml,sml + n1,greater<int>());} if( t < big [0]) { big[0] = t; make_heap(big,big + n2,less<int>());} } for(i=0;i<n1;i++) { sum -= sml[i]; } for(i=0;i<n2;i++) { sum -= big[i]; } printf("%.6lf\n",(double) sum * 1.0 / (n- n1 - n2) ); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator