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

为啥老是RE啊

Posted by xiadaxue at 2010-06-09 21:13:02 on Problem 1200
#include<stdio.h>
#include<string.h>

int main()
{
	char c[8000000];
	int hash[8000000],n,count=0,nc,size,du[1300]={0},size1=0,i,sum,hash1[8000000]={0},j;

	scanf("%d%d",&n,&nc);
	scanf("%s",c);
	size=strlen(c);
	for(i=0;i<size;i++)
	{
		if(du[c[i]]==0)du[c[i]]=size1;
		size1++;
	}
	for(i=0;i<=size-n;i++)
	{
		sum=0;
		for(j=i;j<i+n;j++)
		{
			sum=sum*nc+du[c[j]];
		}
		if(hash1[sum]==0)
		{
			hash1[sum]=1;
			count++;
		}
	}
	printf("%d\n",count);
	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