随笔分类 - 字符串
摘要:题意是给定一个字符串,求最少把它分成多少份,使的每一份都是回文串。 错了好多遍,最后发现是贪心思路出了问题,一开始求出dp[i][j],dp[i][j]表示第i个到第j个这段子串是否是回文串,求出来后,我直接从1开始遍历,每次求最右边的,这种贪心思路是有问题的。 赛后看了别人的才知道可以用动态规划,
阅读全文
摘要:D. Palindromic characteristics Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total n
阅读全文