摘要:
题意:给一个括号串,求最大匹配。题解:记忆化搜索,dp[i][j]为[i,j]的最大匹配,dp[i][j]=max(dp[i+1][j-1]+corr(s[i],s[j]),dp[i][k]+dp[k+1][j]);View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int dp[105][105]; 6 char s[105]; 7 int corr(char a,char b) 8 { 9 if((a=='( 阅读全文