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 swordl3 at 2012-07-05 16:42:52 on Problem 1493
#include <stdio.h>
int main()
{
	char a[20][25];
	int n,i,j,min,sum,count[10];
	scanf("%d",&n);
	getchar();
	while(n)
	{
		for (i=0;i<10;i++)
		{
			count[i]=0;
		}
		min=100;
		sum=0;
		for (i=0;i<n;i++)
		{
			for (j=0;j<25;j++)
			{
				scanf("%c",&a[i][j]);
			}
			getchar();
		}
		for (i=0;i<n;i++)
		{
			for (j=0;j<25;j++)
			{
				if (a[i][j]==' ')
				{
					count[i]++;
				}
			}
		}
		for (i=0;i<n;i++)
		{
			if (min>count[i])
			{
				min=count[i];
			}
		}
		for(i=0;i<n;i++)
		{
			sum=sum+count[i]-min;
		}
		printf("%d\n",sum);
		scanf("%d",&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