| ||||||||||
| 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 | |||||||||
wanpi大牛重出江湖?赞啊赞!!In Reply To:请问,我的程序为什么WA了.先谢了.(内有代码) Posted by:wanpi0user at 2006-06-26 21:00:01 > #include<cstdio>
> #include<cstdlib>
> #include<string>
> #include<cmath>
> #include<iostream>
> #include<fstream>
> #include<iomanip>
> #include<vector>
> #include<algorithm>
> #include<map>
>
> using namespace std;
> int arr[5000005];
> struct greaterthan
> {
> bool operator()(const int& _Left, const int& _Right) const
> {
> return (_Left > _Right);
> }
> };
>
> struct lessthan
> {
> bool operator()(const int& _Left, const int& _Right) const
> {
> return (_Left < _Right);
> }
> };
>
> int main()
> {
> int num, low, high, avr, n, ii;
> __int64 total;
> while(true)
> {
> scanf("%d%d%d",&low,&high, &num);
> if((low == 0) && (high == 0) && (num == 0)) break;
> for(ii = 0; ii < num; ii++)
> {
> scanf("%d",arr + ii);
> }
> nth_element(arr + 0 , arr + low, arr + num, greaterthan());
> nth_element(arr + low, arr + high, arr + num, lessthan());
> for(ii = low + high, total = 0L;ii < num; ii++)
> {
> total += arr[ii];
> }
> printf("%.6lf\n",(double)(total)/(double)(num - low - high));
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator