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 IC0500510078 at 2005-12-20 15:28:52 on Problem 1477
#include<stdio.h>
#include<math.h>
void main()
{
	int n,a=0,z[100][100],s=0,i,sum=0,d=0;
	for(a=0;a<99;a++)
	{   
		scanf("%d",&n);
		s=0;
		if(n==0)
			break;
		while(n!=0)
		{ 
		  for(sum=0,i=0;i<n;i++)
		  {
			scanf("%d",&z[a][i]);
			sum+=z[a][i];
		  }
		  s=sum/n;
		  for(d=0,i=0;i<n;i++)
			{
				if(z[a][i]>s)
	     			  d+=(z[a][i]-s);
			}
		  printf("Set #%d\n",a+1);
		  printf("The minimum number of moves is %d\n",d);
		  break;
		}
		
	}
}

				

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