
动态规划相关算法
ACM 动态规划算法
sizaif
这个作者很懒,什么都没留下…
展开
-
@2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛: J Beautiful Numbers (数位DP)
题目链接:https://www.nowcoder.com/acm/contest/163/J链接:https://www.nowcoder.com/acm/contest/163/J来源:牛客网 NIBGNAUK is an odd boy and his taste is strange as well. It seems to him that a positive intege...原创 2018-08-11 10:32:09 · 190 阅读 · 0 评论 -
@UPC 6902 @中山纪念中学20170304 Trie树(状压DP)
题目描述字母(Trie)树是一个表示一个字符串集合中所有字符串的前缀的数据结构,其有如下特征:1.树的每一条边表示字母表中的一个字母2.树根表示一个空的前缀3.树上所有其他的节点都表示一个非空前缀,每一个节点表示的前缀为树根到该节点的路径上所有字母依次连接而成的字符串。4.一个节点的所有出边(节点到儿子节点的边)中不存在重复的字母。 单词“A”“to”“tea”“ted”“...原创 2018-08-02 09:38:19 · 177 阅读 · 0 评论 -
@钓鱼II (DP)
题目描述在一条水平路边,有n个钓鱼湖,从左到右编号为1,2,…,n。佳佳有H个小时的空余时间,他希望利用这个时间钓到更多的鱼。他从1出发,向右走,有选择的在一些湖边停留一定的时间(是5分钟的倍数)钓鱼。最后在某一个湖边结束钓鱼。佳佳从第i个湖到第i+1个湖需要走5×Ti分钟路,还测出在第i个湖停留,第一个5分钟可以钓到Fi条鱼,以后每再钓5分钟,可以钓到的鱼量减少Di,若减少后的鱼量小于0,则...原创 2018-09-20 08:28:38 · 374 阅读 · 0 评论 -
AtCoder Grand Contest 007: D - Shik and Game (DP)
题目链接地址:https://agc007.contest.atcoder.jp/tasks/agc007_d EditorialD - Shik and GameTime limit : 2sec / Memory limit : 256MBScore : 1200 pointsProblem StatementImagine a game played on a line. Initially...原创 2018-04-22 22:05:13 · 276 阅读 · 0 评论 -
NWERC 2017 :Installing Apps (01背包DP + 思维+ 贪心)
Installing Apps时间限制: 2 Sec 内存限制: 128 MB提交: 170 解决: 24[提交][状态][讨论版][命题人:admin]题目描述Sandra recently bought her first smart phone. One of her friends suggested a long list of applications (more commonly ...原创 2018-04-16 18:37:13 · 737 阅读 · 0 评论 -
@牛客网暑期ACM多校训练营(第三场) A; PACM Team (01背包DP)
链接:https://www.nowcoder.com/acm/contest/141/A来源:牛客网 Eddy was a contestant participating in ACM ICPC contests. ACM is short for Algorithm, Coding, Math. Since in the ACM contest, the most important...原创 2018-07-27 08:26:20 · 252 阅读 · 0 评论 -
@2015ACM/ICPC亚洲区长春站-重现赛(感谢东北师大) @HDU5534 (Dp,完全背包)
题目描述In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two nodes are connected by exactly one path. In other words, any connected graph without simple ...原创 2018-10-04 11:11:00 · 282 阅读 · 0 评论 -
@ 2016GCPC Knapsack in a Globalized World (DP 完全背包)
Globalization stops at nothing, not even at the good old honest profession of a burglar. Nowadays it is not enough to break in somewhere, take everything you can carry and dart off. No! You have to be...原创 2018-10-06 21:40:22 · 335 阅读 · 0 评论 -
山东省第九届ACM: G:Game(DP.动态规划)
题目描述Alice and Bob are playing a stone game. There are n piles of stones. In each turn, a player can remove some stones from a pile (the number must be positive and not greater than the number of remai...原创 2018-05-16 20:14:41 · 225 阅读 · 0 评论 -
@HDU - 6415 - 杭电多校第九场 - Rikka with Nash Equilibrium (DP )
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=6415Rikka with Nash EquilibriumTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1524 A...原创 2018-08-23 16:39:52 · 194 阅读 · 0 评论 -
AtCoder Grand Contest 004 : Colorful Slimes (DP)
Colorful Slimes时间限制: 2 Sec 内存限制: 256 MB提交: 235 解决: 36[提交][状态][讨论版][命题人:admin]题目描述Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those...原创 2018-04-11 16:49:37 · 278 阅读 · 0 评论 -
BZOJ 1003: [ZJOI2006]物流运输 [DP+ 最短路]
Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 9148 Solved: 3952[Submit][Status][Discuss]Description 物流公司要把一批货物从码头A运到码头B。由于货物量比较大,需要n天才能运完。货物运输过程中一般要转停好几个码头。物流公司通常会设计一条固定的运输路线,以便对整个运输过程实施严格的管理和跟踪。由...原创 2018-03-16 19:26:55 · 319 阅读 · 0 评论 -
Codeforces Round #462 (Div. 2) D-A Twisty Movement (枚举)
C. A Twisty Movementtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people m...原创 2018-02-22 19:29:11 · 371 阅读 · 1 评论 -
hdu 2639 01 背包 存在k 个多解问题
题目地址http://acm.hdu.edu.cn/showproblem.php?pid=2639Bone Collector IITime Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4693 Accepte原创 2017-04-18 18:47:12 · 711 阅读 · 0 评论 -
SDKD 2017 Spring Team Training B G题 -The Debut Album or URAL - 2018 (dp 三维)
题目描述Pop-group “Pink elephant” entered on recording their debut album. In fact they have only two songs: “My love” and “I miss you”, but each of them has a large number of remixes.The pro原创 2017-05-02 11:10:45 · 344 阅读 · 0 评论 -
HDU 1559 最大子矩阵和 (dp) 枚举+dp
一个M*N的矩阵,找到此矩阵的一个子矩阵,并且这个子矩阵的元素的和是最大的,输出这个最大的值。例如:3*3的矩阵:-1 3 -12 -1 3-3 1 2和最大的子矩阵是:3 -1-1 31 2第1行:M和N,中间用空格隔开(2 <= M,N <= 500)。第2 - N + 1行:原创 2017-05-23 21:51:34 · 401 阅读 · 0 评论 -
dp 最大字段和 问题
最大字段和 最暴力的算法就是int s = 0;//起始位置int e = 0; //结束位置int max = 0;for(int i = 1; i <= n; ++i){ for(int j = i; j <= n;++j) { int sum = 0; for(int k = i; k <=j; ++k)原创 2017-04-26 20:47:18 · 802 阅读 · 0 评论 -
POJ 3254 Corn Fields (状态压缩)
刚开始的思路是 把0-2^x的 所有状态枚举, 然后找符合条件的, 但是 发现 当12*12 时 1的数量x 超过64 这是个庞大的数字, 跟本就没法枚举;想到用状态压缩, 但是 怎么压缩才行 ?作为这是状态压缩入门题, 感觉 废了好大力气;【思路】 把每一行 0/1状态 转换成 十进制的数, 每一行看成一个整体, 进行压缩, 【第一原创 2017-10-30 14:10:38 · 486 阅读 · 0 评论 -
POJ 1185 炮兵阵地 (状态压缩DP)
炮兵阵地Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 29505 Accepted: 11426Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),原创 2017-10-30 19:22:23 · 724 阅读 · 0 评论 -
HDU 1074 Doing Homework ( 状态压缩 )
Doing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10297 Accepted Submission(s): 4963Problem DescriptionIgnatius h原创 2017-10-26 18:58:05 · 245 阅读 · 0 评论 -
UVA 10934 装满水的气球(Dropping water ballons) (DP)
【题意】给 k 个气球 从1 楼 开始往上 扔, n层高的楼, 假设 一个球 扔到 F楼 如果 气球破了, 说明 硬度不超过 f 失去一个球 和 一次实验;如果没破 失去一次实验, 硬度超过f 层现在想 给k 个气球 确定最少的 实验次数, 才能确定气球硬度【思路】典型动态规划问题;从1 层 开始 往上 扔 dp 【I 】【j】 第原创 2017-11-29 20:00:34 · 655 阅读 · 0 评论 -
Codeforces 768D Jon and Orbs (DP)
D. Jon and Orbstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJon Snow is on the lookout for some orbs re原创 2017-12-06 21:02:05 · 251 阅读 · 0 评论 -
01背包 ,完全背包,多重背包 dp (动态规划入门dp)
dp 动态规划,确实难啃, 光 最简单的 背包问题,就 费老大劲.思想! 思想! 思想! 类似于递推, 局部找 关系. 背包问题, 就两种状态 放还是不放? 其实关于背包放不放的问题,如果用二进制思想来表示的话很好理解, 0 代表不放 1 代表放; 那么对于现有的情况 假设有 n个物品 则 2进制则对应的长度应该为n 对于每一个物品用0 1 表示 000xx~~~1原创 2017-04-12 22:44:42 · 3919 阅读 · 0 评论