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 demon at 2005-10-23 14:26:04 on Problem 1477
In Reply To:我的程序到底哪出错了,为什么总是wa。请大哥大姐帮忙! Posted by:hhhh at 2005-08-28 16:09:51
#include <stdio.h>

int 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(str[j]-aver> 0)
	    count += (str[j]-aver);
      printf("Set #%d\n",i);
      printf("The minimum number of moves is %d.\n\n",count);
    }
   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