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 Crying at 2005-12-03 02:52:00 on Problem 1159
In Reply To:为什么是Runtime Error??问一下哪里出错了?? Posted by:860830 at 2005-12-03 02:30:04
> #include<iostream.h>
> 
> void main()
> {
> 	char str[5000];
> 	int Store[5000][5000] = {0};
> 	int i,j,N;
> 	cin>>N;	
> 	cin>>str;
> 	for( i = 2; i <= N; i++ )	
> 	{		
> 		for( j = 0; j + i <= N+1; j++ )
> 		{
> 			if( str[j] == str[j+i-1])
> 				Store[i][j] = Store[i-2][j+1];
> 			else
> 			{   
> 				if( Store[i-1][j] > Store[i-1][j+1] )
> 					Store[i][j] = Store[i-1][j+1]+1;
> 				else
> 					Store[i][j] = Store[i-1][j]+1;
> 			}
> 		}
> 	}
> 	cout<<Store[N][0]<<endl;
> }

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