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

我这样做的怎么错啊!!!!!!!!!!!!哪位好心人帮忙看一下啊!!!!!!不胜感激

Posted by 22220000 at 2009-03-05 09:43:14 on Problem 2833
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int a[5000001];
int main()
{
    int n1,n2,n;
    while(scanf("%d%d%d",&n1,&n2,&n)!=EOF)
    {
        if(n1==0&&n2==0&&n==0)  break;
        int b[11],c[11];
        for(int i=0;i<11;i++)
        {
            b[i]=0;c[i]=100000001;    
        }
        int i,l,k;
        int max=0,min=100000001;
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[j]);
            if(a[j]>max)
            {
                b[0]=a[j];
                sort(b,b+n1);
                max=b[0];
            }
            if(a[j]<min)
            {
                c[n2-1]=a[j];
                sort(c,c+n2);
                min=c[n2-1];    
            }
        }
        int sum=0;
        for(i=0;i<n;i++)
            sum=sum+a[i];
        for(i=0;i<n1;i++)
            sum=sum-b[i];
        for(i=0;i<n2;i++)
            sum=sum-c[i];
        printf("%.6lf\n",(double)sum/(n-n1-n2));
    }
}

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