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

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

Posted by hhhh at 2005-08-28 16:09:51 on Problem 1477
#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