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 hsx at 2006-08-10 13:10:45 on Problem 2945
我的程序虽然很土,但自己测试了好多数据都是对的,可是一提交,就是WA,我实在是不知道哪里错了,请大家指点。
#include"stdio.h"
#include"string.h"
main()
{
	int n,m,len=0,t1,t2,output[20000];
	char ds[20000][21];
	int i,j,l;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++)
		for(j=0;j<m+1;j++)
			scanf("%c",&ds[i][j]);
    t1=n;t2=m;
    scanf("%d %d",&n,&m);
	n=t1;m=t2;
	for(i=0;i<n;i++)
		output[i]=0;
	for(i=0;i<n;i++)
	{
            if(ds[i][0]!='B')
            { 
		for(j=i+1;j<n;j++)
		{
			if(ds[i][0]==ds[j][0])
			{
				for(l=1;l<m;l++)
					if(ds[i][l]!=ds[j][l])
						break;
				if(l==m)
				{
					len++;
					for(l=0;l<m;l++)
						ds[j][l]='B';
				}
			}

		}
		output[len]++;
		len=0;
            }
	}
	for(i=0;i<n-1;i++)
		printf("%d\n",output[i]);
	printf("%d",output[n-1]);
}

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