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

Re:我的程序到底哪出错了,为什么总是wa。请大哥大姐帮忙!

Posted by lingd at 2008-09-16 21:14:46 on Problem 1477
In Reply To:我的程序到底哪出错了,为什么总是wa。请大哥大姐帮忙! Posted by:hhhh at 2005-08-28 16:09:51
可怜的兄弟,你少加了个点。
> #include <stdio.h>
> 
> main()
> {
>   int n,i,str[55],aver,j,count;
> 
>   for(i = 1;;i++)
>     {
>       scanf("%d",&n);
>       if(n == 0)break;
>       aver = 0;
>       for(j = 0;j < n;j++)
> 	{
> 	  scanf("%d",&str[j]);
> 	  aver += str[j];
> 	}
>       aver /= n;
>       count = 0;
>       for(j = 0;j < n;j++)
> 	if(aver - str[j] > 0)
> 	    count += (aver - str[j]);
> 
>       printf("Set #%d\n",i);
>       printf("The minimum number of moves is %d\n\n",count);
> 
>     }
> 
> }

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