| ||||||||||
| 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 | |||||||||
贴个滚动数组代码 for (int i = 2; i<=n; i++ )
{
int x = i%3 , y = (i-1)%3 , z = (i-2)%3;
for (int j = 0; j < n-i+1; j++ )
{
if ( s[j] == s[j+i-1] ) dp[x][j] = dp[z][j+1];
else dp[x][j] = dp[z][j+1] + 2;
dp[x][j] = min( dp[x][j] , dp[y][j] + 1 );
dp[x][j] = min( dp[x][j] , dp[y][j+1] + 1 );
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator