[BZOJ 1260][CQOI2007]染色(DP)
题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1260
分析:
f[i][j]表示i~j刷成s[i]~s[j]这个样子需要的最小次数
则若s[i]==s[j]:f[i][j]=min(f[i+1][j],f[i][j-1],f[i+1][j-1]+1)
若s[i]!=s[j]:f[i][j]=min(f[i][k]+f[k+1][j])
题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1260
分析:
f[i][j]表示i~j刷成s[i]~s[j]这个样子需要的最小次数
则若s[i]==s[j]:f[i][j]=min(f[i+1][j],f[i][j-1],f[i+1][j-1]+1)
若s[i]!=s[j]:f[i][j]=min(f[i][k]+f[k+1][j])