题目大意:给定一个字符串,求最少插入几个字符让该字符串成为回文串
法一:
dp[i][j]表示使区间[i,j]成为回文串最小插入的字符数,则状态转移方程
1、if s[i]==s[len-1] 则:d[i][j]=d[i+1][j-1]
2、else d[i]=min(dp[i+1][j],dp[i][j-1])
首尾字符不同的时候,有两种决策。
1、将新字符插在首位,那么状态就...
分类:
其他好文 时间:
2014-07-21 23:30:01
阅读次数:
255
公司配置的 dell optiplex使用核显带起双屏幕,玩dota2无法特效全开。so,在京东上买了一块750Ti。安装驱动的时候需要切换到ubuntu的全命令行模式,关掉桌面系统才能安装。这时候这个坑出现了,要想安装驱动,就必须进入全命令行模式,要想进入命令行模式必须有驱动。反复尝试后,发现只能用DP口带单屏幕才能成功。在这里特别记录下。嘎嘎...
分类:
其他好文 时间:
2014-07-21 23:27:32
阅读次数:
279
怒拿一血,first blood,第一个区间DP,第一次就这样子莫名其妙不知不觉滴没了~~~
题目虽然是鸟语,但还是很赤裸裸的告诉我们要求最大的括号匹配数,DP走起~
dp[i][j]表示区间[i,j]的最大匹配数,那么最重要的状态转移方程就是:
dp[i][j]=max(dp[i][k]+dp[k+1][j])
对啦,要先初始化边界啊,两步走~:
memset(dp,0,siz...
分类:
其他好文 时间:
2014-07-21 23:27:29
阅读次数:
214
求1-x中出现连续的49的数有多少个(注意要用long long)...
分类:
其他好文 时间:
2014-07-21 22:48:18
阅读次数:
255
Problem Description
The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show itself. The show is hold in the Small hall...
分类:
其他好文 时间:
2014-07-21 22:36:27
阅读次数:
249
Bone Collector
Time Limit: 2000/1000 MS (Java/Others) Memory Limit:
32768/32768 K (Java/Others)
...
分类:
其他好文 时间:
2014-07-21 22:36:27
阅读次数:
222
求出a到b之间 1)不含有连续的62 2)不含有4
的数的个数...
分类:
其他好文 时间:
2014-07-21 22:36:18
阅读次数:
209
Description
FJ has purchased N (1
The treats are interesting for many reasons:
The treats are numbered 1..N and stored sequentially in single file in a long box that is open at both ends. On...
分类:
其他好文 时间:
2014-07-21 22:18:18
阅读次数:
227
windy数:不含前导零且相邻两个数字之差至少为2的正整数。输入x、y,求[x, y]内的windy数的个数...
Description
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points ...
分类:
其他好文 时间:
2014-07-21 22:11:18
阅读次数:
289