
动态规划 区间dp
文章平均质量分 79
Fsss_7
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #336 (Div. 1) B. Zuma
B. Zumatime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputGenos recently installed the game Zuma on his phone原创 2015-12-25 02:56:15 · 526 阅读 · 0 评论 -
UVALive 3516Exploring Pyramids
题意:给定一个字符串S,这个s串是一棵树的dfs序。求dfs序为s的树有多少种情况。分析:《算法竞赛入门经典训练指南》数学基础例题4。代码:#include#include#include#include#include#include#include#include#include#include#include#include#pragma comment(原创 2016-03-16 01:01:13 · 431 阅读 · 0 评论 -
poj1651Multiplication Puzzle
链接:http://poj.org/problem?id=1651题意:给定n个数,求消除掉中间n-2个数最小代价,消除数a[i]的代价为a[l]*a[i]*a[r],a[l]和a[r]是它左右两边最近的剩下的数。分析:设dp[i][j]表示消除i+1~j-1最小代价,那么合并就是dp[l][r]=min(dp[l][k]+dp[k][r]+a[l]*a[k]*a[r])。代码:#原创 2016-07-14 15:19:21 · 319 阅读 · 0 评论 -
hdu5760Palindrome Bo
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5760题意:给定一个n个元素的数组,求最长的回文子序列并且要求从中间到两边是非递减的,要求输出长度和有多少个本质不同的最长的回文子序列。分析:如果只是要求长度,这题的难度要小好多,直接用a数组和a的逆数组求最长公共不上升子序列即可,有兴趣的可以自己去找题做做。但是这题还要求输出有多少个本质不同的子序原创 2016-07-29 17:46:06 · 733 阅读 · 0 评论