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

谁帮我看看一直,Runtime Error..............

Posted by jiangwuqwe at 2010-05-16 22:32:38 on Problem 3690
#include <stdio.h>
#include <string.h>
#include <windows.h>

#define MAXN 101
#define MINN 51
#define elem_t char

elem_t arr[MAXN][MAXN];
elem_t arr1[MINN][MINN];
int N,M,T,P,Q;

int TestArr()
{
	int i,j,k,num=0;
	for (i=0;i<=N-P;i++)
	{
		for(j=0;j<=M-Q;j++)
		{
			for (k=0;k<P;k++)
			{
				if(strncmp(arr[i+k]+j,arr1[k],Q))
					break;
			}
			if(k==P) num++;
		}
	
	}
	return num;
}

int main()
{
	int i,j=1,num;
	//long start = GetTickCount();
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	while (scanf("%d%d%d%d%d%*c",&N,&M,&T,&P,&Q))
	{
		if(N==0||M==0||P==0||Q==0||T==0)break;
		for(i=0;i<N;i++)
		{
			memset(arr[i],0,M+1);
		}
		for(i=0;i<P;i++)
		{
			memset(arr1[i],0,Q+1);
		}
		for(i=0;i<N;i++)
		{
			scanf("%s",arr[i]);
		}
		num=0;
		while(T--)
		{
			for (i=0;i<P;i++)
			{
				scanf("%s",arr1[i]);
			}
			num += TestArr();
		}
		printf("Case %d: %d\n",j++,num);
	}

	//printf("%d ms\n",GetTickCount()-start);
	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