题目: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])
时间: 2024-12-16 03:37:43
题目: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])