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 chengning at 2006-07-20 21:29:00 on Problem 1477
#include<iostream.h>
int main()
{
	int n,m,k,M[50],i,j;
	m=k=j=0;
	cin>>n;
	while(n!=0)
	{
		for(i=0;i<n;i++)
		{
			cin>>M[i];
			m+=M[i];
		}
		if(m%n==0)
		{
			for(i=0;i<n;i++)
			{
				if(M[i]>m/n)
				{
					k+=M[i]-m/n;
				}
			}
		}
		j++;
		cout<<"Set #"<<j<<endl;
		cout<<"The minimum number of moves is"<<' '<<k<<'.'<<endl;
		cin>>n;
	}
	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