看到Palindrome的题目,首先想到的应该是中心问题,然后从中心出发,思考如何解决。
DP问题一般是从更加小的问题转化到更加大的问题,然后是从地往上 bottom up地计算答案的。
能得出状态转移方程就好办了,本题的状态转移方程是:
if (cowID[i] == cow{j]) tbl[id][i] = tbl[id][i+1];//相等的时候无需改动
else tbl[id][i...
分类:
其他好文 时间:
2014-08-09 00:14:16
阅读次数:
344
Unique Paths IIFollow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle an...
分类:
其他好文 时间:
2014-08-08 23:55:17
阅读次数:
263
Binary Tree Level Order Traversal IIGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level...
分类:
其他好文 时间:
2014-08-08 23:53:16
阅读次数:
221
Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in whi...
分类:
其他好文 时间:
2014-08-08 23:51:16
阅读次数:
315
Up函数 用来更新父亲节点的值void push(int w){ sum[w] = sum[2*w]+sum[2*w+1];//更新节点值}单点更新 先找出第p个数 然后更新他的值void add(int p,int d,int l,int r,int w){ if(l==r) ...
分类:
其他好文 时间:
2014-08-08 23:47:46
阅读次数:
277
http://wiki.hudson-ci.org/display/HUDSON/Subversion+Release+ManagerThis plugin allows you to set up a job in Hudson for building specific revisions of...
分类:
其他好文 时间:
2014-08-08 12:30:25
阅读次数:
218
转自09年的blog,因为facebook在国内无法访问,故此摘录。The Photos application is one of Facebook’s most popular features. Up to date, users have uploaded over 15 billion p...
分类:
其他好文 时间:
2014-08-08 12:26:55
阅读次数:
374
http://codeforces.com/contest/452/problem/BB. 4-point polylinetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputs...
分类:
数据库 时间:
2014-08-08 09:34:46
阅读次数:
281
Description
Anton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up...
分类:
其他好文 时间:
2014-08-07 13:23:50
阅读次数:
295
This topic provides guidelines on how to sign up for SQL Server on a Azure virtual machine and how to get started creating SQL Server databases in Mic...
分类:
数据库 时间:
2014-08-07 12:53:30
阅读次数:
406