[LightOJ1004]Monkey Banana Problem(dp)】的更多相关文章

题目链接:http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1004 题意:数塔的变形,上面一个下面一个,看清楚了直接做就行了. 上半部分转移方程dp(i,j)=max(dp(i-1,j),dp(i-1,j+1))+G(i,j) 下半部分转移方程dp(i,j)=max(dp(i-1,j-1),dp(i-1,j))+G(i,j) #include <algorithm> #include <iostre…
题目大意: 给你一菱形的数字阵,问从最上面走到最下面所能获得的最大值是多少? #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> #include<queue> #include<vector> #include<map> using namespace std; typedef lo…
You are in the world of mathematics to solve the great "Monkey Banana Problem". It states that, a monkey enters into a diamond shaped two dimensional array and can jump in any of the adjacent cells down from its current position (see figure). Wh…
貌似最近刷了好多的CF题…… 题目链接:CF原网 洛谷 题目大意:有一个长度为 $n$ 的字符串 $s$,删除第 $i$ 个字符需要代价 $a_i$.问使得 $s$ 不含有子序列(不是子串)"hard" 的最小花费. $1\le n\le 10^5,1\le a_i\le 10^9$,$s$ 只包含小写字母. 其实就是一简单DP. $dp[i][j]$ 表示考虑到 $s$ 的前缀 $i$,目前最远能匹配到 "hard" 的位置,的最小花费. 比如,$dp[3][2]…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
dp[i][j] := 前i个数和为j的情况(mod p) dp[i][j] 分两种情况 1.不选取第i个数 -> dp[i][j] = dp[i-1][j] 2.   选取第i个数 -> dp[i][j] = dp[i-1][t] ((t+a[i])%p==j) (为什么很简单的题,思路也有了,比赛的时候就是写不对呢?) #include <iostream> #include <cstdio> #include <cstring> using names…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069 题意就是给你n种长方体每种类型不限制个数,然后我们把它们一个个堆起来,并且要满足下面的要比上面的大,不能相等,求最大能达到的高度:我们可以把这归为动态规划,求最长上升子序列的问题 #include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algor…
LightOJ 1033  Generating Palindromes(dp) 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87730#problem/A 题目: Description By definition palindrome is a string which is not changed when reversed. "MADAM" is a nice example of palindrome.…
lightOJ 1047   Neighbor House (DP) 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87730#problem/C 题目: Description The people of Mohammadpur have decided to paint each of their houses red, green, or blue. They've also decided that no two n…
UVA11125 - Arrange Some Marbles(dp) option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2066" target="_blank" style="">题目链接 题目大意:给你n种不同颜色的弹珠.然后给出每种颜色的弹珠的个数,如今要求你将这些弹珠排序,要求同样颜色的部分最多3个.然后同样颜色的弹珠称…