Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
动态规划 ,为什么会runtime error?高手期待中 数组越界基本不可能#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator