| ||||||||||
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 |
为什么总是超时?# include< iostream.h > short dp[5010][5010]; // 保存每一步的状态 char s[5010]; void main() { int len,i,j; cin>> len; cin>> s; for( i= 0; i< len; i++ ) for( j=1; j+i <= len; j++ ) if( s[j-1] == s[i+j-1] ) dp[j][i+j]= dp[j+1][i+j-1]; else dp[j][i+j]= ( dp[j][i+j-1] < dp[j+1][i+j] ? dp[j][i+j-1]:d[j+1][i+j])+1; cout<<dp[1][len]<<endl; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator