Partitioning by Palindromes uva111584

main algorithm:

to count how many Palindromes a string include

give out   all the  way it combine, and judge whether its a Palindromes, if it is, f[i] = min(f[i]. f[j-1]+1)

code:

#include
#include
#include
using namespace std;
const int N = 1005;
int dp[N][N];
char str[N];
int f[N];
bool judge(int l, int r) {
	while(l


你可能感兴趣的:(动态规划)