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:请大家帮帮我吧,我总是RE

Posted by noskill at 2005-04-03 23:02:15 on Problem 1458
In Reply To:请大家帮帮我吧,我总是RE Posted by:hugh_USTC at 2005-02-26 10:03:36
> #include <iostream.h>
> #include <string.h>
> void main()
> {
> 	int C[99][99];
> 	char X[100];
> 	char Y[100];
> 	while (cin>>X+1>>Y+1)
> 	{
> 		int m = strlen(X+1), n = strlen(Y+1);
> 		int i = 0;
> 		for(i=0;i<=m;i++) C[i][0] = 0;
> 		for(i=0;i<=n;i++) C[0][i] = 0;
> 		for(i=1;i<=m;i++)
> 		{
> 			for(int j=1;j<=n;j++)
> 			{
> 				if (X[i] == Y[j])
> 				{
> 					C[i][j] = C[i-1][j-1] + 1;
> 				}
> 				else if (C[i-1][j] >= C[i][j-1])
> 				{
> 					C[i][j] = C[i-1][j];
> 				}
> 				else
> 				{
> 					C[i][j] = C[i][j-1];
> 				}
> 			}
> 		}
> 		cout << C[m][n] << endl;
> 	}
> }
你的数组开得太小了,开到500就能过

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