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 zhouhai2118 at 2008-08-17 11:54:25 on Problem 3507
#include <stdio.h>
#include <stdlib.h>

int cmp(const void *p1, const void *p2)
{
    return *(long *)p1 - *(long *)p2;
}

int main()
{
    long s[6];
    int i;

    while(s[0]&&s[1]&&s[2]&&s[3]&&s[4]&&s[5])
    {   
         for( i=0;i<6;i++)
            scanf("%d",&s[i]); 
         if((s[0]+s[1]+s[2]+s[3]+s[4]+s[5]) == 0) break;
         qsort(s,6,sizeof(s[0]),cmp);
         printf("%g\n",(s[1]+s[2]+s[3]+s[4])/4.0);
    }
    return 0;
}

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