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

2192 Zipper WA到无语,请求援助,伸出你们的援手吧,大侠

Posted by linxi1151 at 2008-06-12 16:36:30
说下特别需要注意的地方也感激不尽!!!
给个测试实例也行!!
#include "iostream"
#include "fstream"
using namespace std;

bool s[205][205];

int main()
{
	int i,j,lena,lenb,t,n;
	char a[205],b[205],c[405];
	//ifstream file("1.txt");
    scanf("%d",&n);//file>>n;
	t= 1;
	while(t++ <= n)
	{
		scanf("%s%s%s",a+1,b+1,c+1) ;//file>>a+1>>b+1>>c+1;
		memset(s,0,sizeof(s));
		lena = strlen(a);
		lenb = strlen(b);
		s[0][0] = 1;
		for(i = 1 ; i < lena ; i ++)
			if(s[i - 1][0] && c[i] == a[i]) s[i][0] = 1;
		for(j = 1 ; j < lenb ; j ++)
			if(s[0][j - 1] && c[j] == b[j]) s[0][j] = 1;

		for(i = 1 ; i < lena ; i ++)
		{
			for(j = 1 ; j <lenb ; j ++)
			{
				if(s[i][j - 1] && c[i + j] == b[j] || s[i - 1][j] && c[i + j] == a[i] ) s[i][j] = 1;
				else s[i][j] = 0;
			}
		}
		if(s[lena -1][lenb -1])printf("Data set %d: yes\n", t - 1);
		else printf("Data set %d: no\n", t - 1);
		
	}
	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