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:动态规划 ,为什么会runtime error?高手期待中 数组越界基本不可能

Posted by slp at 2009-12-13 20:35:09 on Problem 1159
In Reply To:动态规划 ,为什么会runtime error?高手期待中 数组越界基本不可能 Posted by:lyl625760 at 2008-10-23 11:03:17
> #include<conio.h>
> #include<iostream>
> using namespace  std;
> 
> 
> int main()
> {
>    
>    int n;
>    cin>>n;
>   
>    int min[n][n];
>    for (int i=0 ;i<n;i++)
>    for(int j=0;j<n;j++)
>     min[i][j]=0; 
>      
>     string ss;
>     cin>>ss;
>     
>  for(int i=n-2;i>=0;i--)
>  for(int j=i+1;j<n;j++)
>  {
>    if(ss[i]==ss[j])                                  
>     min[i][j]=min[i+1][j-1];
>    else
>      min[i][j] = 1 + (min[i+1][j]<min[i][j-1] ? min[i+1][j]:min[i][j-1]); 
>  }   
> 
>  cout<<min[0][n-1]<<endl;
>  
>     
>   getch();
>   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