标签:max ring color vector tor col ret class lse
#include <cmath> #include <vector> #include <algorithm> #include <bits/stdc++.h> using namespace std; int main() { string s,t; cin>>s; t=s; reverse(s.begin(),s.end()); int n=s.size(); vector<vector<int>>f(n+1,vector<int>(n+1,0)); for(int i=1;i<=n;i++) for(int j=1;j<=n;j++){ if(s[i-1]==t[j-1])f[i][j]=f[i-1][j-1]+1; else f[i][j]=max(f[i-1][j],f[i][j-1]); } cout<<n-f[n][n]<<endl; return 0; }
标签:max ring color vector tor col ret class lse
原文地址:https://www.cnblogs.com/programyang/p/11216315.html