lightoj1169【DP】】的更多相关文章

题意(来自大哥): 有两栋楼,左边一栋,右边一栋,层数从1-n,地面的标号为0,每一层有一个水果.有一只猴子在地面上,他现在要上到n层去,在第i层会吃掉水果花费一定时间. 猴子有两种方式从第i层到i+1层,一种是直接往上跳且不花费时间,另一种是花费一定时间到另一栋楼的同一层,然后花费一定时间吃了那层的水果,然后上去且不花费时间: 问猴子到第n层最少时间多少. 在左边每一层吃水果的时间是a[i],右边是b[i]; 左边跳到右边是t1[i],右边跳到左边是t2[i]; 思路: dp[i][j]代表到…
Kattis - honey[DP] 题意 有一只蜜蜂,在它的蜂房当中,蜂房是正六边形的,然后它要出去,但是它只能走N步,第N步的时候要回到起点,给出N, 求方案总数 思路 用DP 因为N == 14 所以 最多走7步 我们不妨设 (7, 7) 为原点,然后 dp[0][7][7] = 1 因为 N == 0 的时候 方案数只有一个 那就是 不动吧.. dp[i][j][k] i 代表第几步 j k 分别表示 目前的位置 一个点 在一张图里面本来有八个方向可以走 这里六边形 我们只取六个方向就可…
HDOJ 1423 Greatest Common Increasing Subsequence [DP][最长公共上升子序列] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8768 Accepted Submission(s): 2831 Problem Description This is a problem from ZOJ 24…
HDOJ 1501 Zipper [DP][DFS+剪枝] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10886 Accepted Submission(s): 3925 Problem Description Given three strings, you are to determine whether the third str…
HDOJ 1257 最少拦截系统 [DP] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 50753 Accepted Submission(s): 19895 Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹…
HDOJ 1159 Common Subsequence[DP] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 44280 Accepted Submission(s): 20431 Problem Description A subsequence of a given sequence is the given sequence wit…
HDOJ_1087_Super Jumping! Jumping! Jumping! [DP] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 44670 Accepted Submission(s): 20693 Problem Description Nowadays, a kind of chess game called "Super…
POJ_2533 Longest Ordered Subsequence[DP][最长递增子序列] Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 58448 Accepted: 26207 Description A numeric sequence of ai is ordered if a1 < a2 < - < aN. Let the subsequenc…
HackerRank - common-child[DP] 题意 给出两串长度相等的字符串,找出他们的最长公共子序列e 思路 字符串版的LCS AC代码 #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <deque> #include <vector> #include <queue> #include…
LeetCode:零钱兑换[322][DP] 题目描述 给定不同面额的硬币 coins 和一个总金额 amount.编写一个函数来计算可以凑成总金额所需的最少的硬币个数.如果没有任何一种硬币组合能组成总金额,返回 -1. 示例 1: 输入: coins = [1, 2, 5], amount = 11 输出: 3 解释: 11 = 5 + 5 + 1 示例 2: 输入: coins = [2], amount = 3 输出: -1 说明:你可以认为每种硬币的数量是无限的. 题目分析 很显然,这是…