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 |
大牛们看看我这错在哪了。。。先谢谢大家了。。。#include<iostream> #include<vector> #include<algorithm> using namespace std; bool cmp(int a,int b) { return a > b; } int main() { int n1,n2; int n; while( scanf("%d%d%d",&n1,&n2,&n) ) { if( n1 == 0 && n2 == 0 && n == 0 ) { break; } else { int i; int temp; __int64 sum = 0; vector<int> point; point.clear(); for( i = 0; i < n; i++ ) { scanf("%d",&temp); sum += temp; point.push_back(temp); } sort(point.begin(),point.end(),cmp); vector<int>::iterator itr; for( itr = point.begin(); itr < point.begin() + n1; itr++ ) { sum -= *itr; } for( itr = point.end() - n2; itr < point.end(); itr++ ) { sum -= *itr; } printf("%0.6lf\n",(double)sum/(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