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 |
为什么用滚动数组不好使啊???int dp(int l1,int l2) { int i ,j; int k = 1; memset(len,0,sizeof(len)); for(i = 1; i <= l1; i++) { for (j = 1; j <= l2;j++) { if (str1[i] == str2[j]) len[k][j] = len[1 - k][j-1]+1; else if (len[1 - k][j] >= len[k][j-1]) len[k][j] = len[1 - k][j]; else len[k][j] = len[k][j-1]; } k = 1 - k; } return (max(l1,l2) - len[1 - k][l2]); } /* char str1[1001],str2[1001]; int len[2][1001]; */ Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator