随笔分类 -  动态规划

摘要:Problem Arrangement ZOJ - 3777 The 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward is going to arrange 阅读全文
posted @ 2019-04-22 21:41 *starry* 阅读(215) 评论(0) 推荐(0)
摘要:String painter HDU - 2476 There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful str 阅读全文
posted @ 2019-03-28 17:07 *starry* 阅读(395) 评论(0) 推荐(0)
摘要:666RPG 题解: 这个题和ZOJ - 2972 很像,同样是DP每一轮可能取到的值,不同在于由于数组不能为负数,我们需要重新选一个较大的值作为0基准线,因为无法将二维数组开的太大,所以我们可以定义flag代表第几轮,flag^=1表示当前轮和上一轮来回交替,即dp第一维只用开到2即可。 %杰哥 阅读全文
posted @ 2019-03-04 21:50 *starry* 阅读(270) 评论(0) 推荐(0)
摘要:Hurdles of 110m ZOJ - 2972 In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Oly 阅读全文
posted @ 2019-03-04 21:42 *starry* 阅读(206) 评论(0) 推荐(0)
摘要:P2014 选课 链接 题目描述 在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之前学习。现在有N门功课,每门课有个学分,每门课有一门或没有直接先修课(若课程a是课程b的先修课即只有学完了课程a,才能学习课程 阅读全文
posted @ 2019-02-25 18:10 *starry* 阅读(131) 评论(0) 推荐(0)
摘要:P2015 二叉苹果树 https://www.luogu.org/problemnew/show/P2015 题目描述 有一棵苹果树,如果树枝有分叉,一定是分2叉(就是说没有只有1个儿子的结点) 这棵树共有N个结点(叶子点或者树枝分叉点),编号为1-N,树根编号一定是1。 我们用一根树枝两端连接的 阅读全文
posted @ 2019-02-25 17:19 *starry* 阅读(253) 评论(0) 推荐(0)
摘要:Treats for the Cows POJ - 3186 FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells o 阅读全文
posted @ 2019-02-22 13:00 *starry* 阅读(179) 评论(0) 推荐(0)
摘要:You Are the One HDU - 4283 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 ho 阅读全文
posted @ 2019-02-21 14:00 *starry* 阅读(244) 评论(0) 推荐(0)
摘要:Palindrome subsequence HDU - 4632 In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements with 阅读全文
posted @ 2019-02-20 23:05 *starry* 阅读(305) 评论(0) 推荐(0)
摘要:Cutting Sticks UVA - 10003 题意:给一个0-L长度的木板,然后给N个数,表示0-L之间的某个刻度,最后要用刀把每个刻度都切一下 使其断开,然后每次分裂的cost是分裂前的木板的长度。求整个分开之后的最小cost。 题解: 区间DP 设dp[i][j]为切割小木棍i~j的最小 阅读全文
posted @ 2019-02-20 16:38 *starry* 阅读(198) 评论(0) 推荐(0)
摘要:处女座与复读机 链接:https://ac.nowcoder.com/acm/contest/327/G 题目描述 一天,处女座在牛客算法群里发了一句“我好强啊”,引起无数的复读,可是处女座发现复读之后变成了“处女座好强啊”。处女座经过调查发现群里的复读机都是失真的复读机,会固定的产生两个错误。一个 阅读全文
posted @ 2019-02-13 14:31 *starry* 阅读(253) 评论(0) 推荐(0)
摘要:小a的子序列 题目链接:https://ac.nowcoder.com/acm/contest/317/F 题目描述 小a有一个长度为nn的序列,但是他忘了这个序列的样子,他只记得序列中的数大小在[1,V][1,V]内 你可以任意选择一些位置,并给它们赋值来组成一段子序列,需要满足序列中的数严格递增 阅读全文
posted @ 2019-02-12 17:52 *starry* 阅读(188) 评论(0) 推荐(0)
摘要:Rinne Loves Edges 题目描述 Rinne 最近了解了如何快速维护可支持插入边删除边的图,并且高效的回答一下奇妙的询问。 她现在拿到了一个 n 个节点 m 条边的无向连通图,每条边有一个边权 wiwi 现在她想玩一个游戏:选取一个 “重要点” S,然后选择性删除一些边,使得原图中所有除 阅读全文
posted @ 2019-02-11 23:13 *starry* 阅读(158) 评论(0) 推荐(0)
摘要:Bag of mice CodeForces - 148D The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mounta 阅读全文
posted @ 2019-02-11 13:36 *starry* 阅读(311) 评论(0) 推荐(0)
摘要:Dice (III) LightOJ - 1248 Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at 阅读全文
posted @ 2019-02-11 13:26 *starry* 阅读(451) 评论(0) 推荐(0)
摘要:Aeroplane chess HDU - 4405 Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each s 阅读全文
posted @ 2019-02-11 12:39 *starry* 阅读(324) 评论(0) 推荐(0)
摘要:Discovering Gold LightOJ - 1030 You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amo 阅读全文
posted @ 2019-02-11 12:37 *starry* 阅读(325) 评论(0) 推荐(0)
摘要:Play Game HDU - 4597 Alice and Bob are playing a game. There are two piles of cards. There are N cards in each pile, and each card has a score. They t 阅读全文
posted @ 2019-01-28 23:13 *starry* 阅读(369) 评论(0) 推荐(0)
摘要:蓝桥杯 地宫寻宝 X 国王有一个地宫宝库。是 n x m 个格子的矩阵。每个格子放一件宝贝。每个宝贝贴着价值标签。 地宫的入口在左上角,出口在右下角。 小明被带到地宫的入口,国王要求他只能向右或向下行走。 走过某个格子时,如果那个格子中的宝贝价值比小明手中任意宝贝价值都大,小明就可以拿起它(当然,也 阅读全文
posted @ 2019-01-28 22:25 *starry* 阅读(341) 评论(0) 推荐(0)
摘要:D - Balanced Number HDU - 3709 A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, 阅读全文
posted @ 2019-01-25 23:09 *starry* 阅读(209) 评论(0) 推荐(0)