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

不知哪里错了?求高手看一下,感激不尽!

Posted by contest_1 at 2009-01-06 18:00:36 on Problem 2774
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int c[100002][100002] = {0};

int main()
{
	//fstream cin("file");
	int m,n;
	string s,t;
	int i,j;
	int maxval = 0;
	cin >> t >> s;
	m = s.length() - 1;
	n = t.length() - 1;
	t = ' ' + t;
	s = ' ' + s;
	for (i = 1;i <= m;i++)
	{
		for (j = 1;j <= n;j++)
		{
			if ( s[i] == t[j])
			{
				c[i][j] = c[i - 1][j - 1] + 1;
				if (maxval < c[i][j])
				{
					maxval = c[i][j];
				}
			}
		}
	}
	cout << maxval + 1 << endl;
	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