![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DP
楚江枫
不忘初心,方得始终
展开
-
【SDUT [2146]最小子序列和】
最小子序列和 Time Limit: 1000MS Memory Limit: 65536KB Problem Description给你一个长为n(10Input有多组(小于11组)测试数据,每组第一行输入n和k(用空格隔开),第二行输入n个数(数之间用空格隔开)。 Output请输出最小的和。 Example Input15 5 5 4 3 2 1 1 2 3 4原创 2016-09-12 10:28:26 · 542 阅读 · 0 评论 -
【2014年第五届蓝桥杯C/C++程序设计本科B组决赛 出栈次序(结果填空) 】
2014年第五届蓝桥杯C/C++程序设计本科B组决赛试题出栈次序 X星球特别讲究秩序,所有道路都是单行线。一个甲壳虫车队,共16辆车,按照编号先后发车,夹在其它车流中,缓缓前行。 路边有个死胡同,只能容一辆车通过,是临时的检查站,如图【p1.png】所示。 X星球太死板,要求每辆路过的车必须进入检查站,也可能不检查就放行,也可能仔细检查。 如果车辆进入检查站和离开的次序可以任意交错。那么,该原创 2017-05-20 10:57:59 · 2882 阅读 · 0 评论 -
【51nod 1596 搬货物】+ dp
1596 搬货物 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注 现在有n个货物,第i个货物的重量是 2 w i 。每次搬的时候要求货物重量的总和是一个2的幂。问最少要搬几次能把所有的货物搬完。 样例解释: 1,1,2作为一组。 3,3作为一组。Input 单组测试数据。 第一行有原创 2017-04-20 22:04:42 · 405 阅读 · 0 评论 -
【zzulioj 2134: 维克兹的进制转换】+ dp
2134: 维克兹的进制转换 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 164 Solved: 21SubmitStatusWeb Board Description 我进入了突如其来的强光。闪烁。闪烁,闪烁,闪烁。我调整好眼睛,评估我前方的景观。 有东西在乱窜。我往下看,发现了一只小个的白色生物,用后腿站立着,嗅闻着我的躯体。它吸引原创 2017-04-17 20:13:48 · 690 阅读 · 0 评论 -
【HDU 1398 Square Coins】+ 母函数
Square CoinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11874 Accepted Submission(s): 8142Problem Description People in Silverland use原创 2017-03-16 21:36:05 · 593 阅读 · 0 评论 -
【HDU 1466 计算直线的交点数】+ dp
计算直线的交点数Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9762 Accepted Submission(s): 4449Problem Description 平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点原创 2017-03-11 11:00:10 · 390 阅读 · 0 评论 -
【HPU 1235 入学考试 】+ 01dp
1235: 入学考试 [DP] 时间限制: 1 Sec 内存限制: 128 MB提交: 18 解决: 8 题目描述辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给他出了一个难题。医师把他带到一个到处都是草药的山洞里对他说:“孩子,这个山洞里有一些不同的草药,采每一株都需要一些时间,每一株也有它自身的价值。我会给你一段时间,在原创 2017-02-12 14:27:41 · 464 阅读 · 0 评论 -
【Codeforces 711 C】+ dp
C. Coloring Trees time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output ZS the Coder and Chris the Baboon has arrived at Udayland! They walked i原创 2017-02-18 15:07:13 · 437 阅读 · 0 评论 -
【Codeforces 766 C Mahmoud and a Message】 + dp
C. Mahmoud and a Message time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputMahmoud wrote a message s of length n. He wants to send it原创 2017-02-08 16:54:59 · 509 阅读 · 0 评论 -
【Codefroces 490 C Hacking Cypher】+ dp
C. Tennis Championship time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputFamous Brazil city Rio de Janeiro holds a tennis tournament a原创 2017-02-05 20:56:11 · 382 阅读 · 0 评论 -
【数据结构 是否为二叉排序树】
问题 A: 谷神的赌博游戏 时间限制: 1 Sec 内存限制: 16 MB 提交: 340 解决: 69 [提交][状态][讨论版] 题目描述 NEUQ的谷神要和我赌一个游戏:谷神要求我随机在纸上写出整数集合{1,2,3,…,3n+1}(n是整数)的一个排列(即不重复的随机写出从1到3n+1的所有整数)。并且要求在我写的过程中,从我写的第一个数开始一直加到我正在写的数的总和不被3原创 2017-06-11 18:10:54 · 431 阅读 · 0 评论 -
【HDU 6083 度度熊的午饭时光】 + dp
度度熊的午饭时光Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 64 Accepted Submission(s): 32Problem Description 度度熊最期待每天的午饭时光,因为早饭菜品清淡,晚饭减肥不敢吃太多(胖原创 2017-08-07 12:16:13 · 406 阅读 · 0 评论 -
【HDU 6082 度度熊与邪恶大魔王】 + dp
度度熊与邪恶大魔王Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 110 Accepted Submission(s): 35Problem Description 度度熊为了拯救可爱的公主,于是与邪恶大魔王战斗起来。邪恶大魔王的原创 2017-08-07 12:03:34 · 351 阅读 · 0 评论 -
【Codeforces 835 C. Star sky】+ dp
C. Star sky time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The Cartesian coordinate system is set in the sky. There you can see n stars,原创 2017-08-05 09:21:43 · 457 阅读 · 0 评论 -
【HDU 1024 Max Sum Plus Plus】+ dp
Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 30112 Accepted Submission(s): 10593Problem Description Now I think you hav原创 2017-07-27 10:54:25 · 310 阅读 · 0 评论 -
【HDU 6035 Colorful Tree】+ 树形 dp + 思维
Colorful TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 2124 Accepted Submission(s): 908Problem Description There is a tree with n n原创 2017-08-02 21:53:06 · 368 阅读 · 0 评论 -
【51nod 球与切换器】+ dp
球与切换器 李陶冶 (命题人) 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 有N行M列的正方形盒子。每个盒子有三种状态0, -1, +1。球从盒子上边或左边进入盒子,从下边或右边离开盒子。规则: 如果盒子的模式是-1,则进入它的球从下面出去。(方向变为向下) 如果盒子的模式是+1,则进入它的球从右面出去。 (反向变为向右) 如果盒子的模式是0, 则进入它的球方向不变原创 2017-07-23 20:47:38 · 281 阅读 · 0 评论 -
【HDU 1074 Doing Homework】+ 状压dp
Doing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9522 Accepted Submission(s): 4505Problem Description Ignatius has just come b原创 2017-07-20 20:55:32 · 404 阅读 · 0 评论 -
【HDU 1257 最少拦截系统】+ dp
最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 42989 Accepted Submission(s): 16746Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种原创 2017-07-20 17:36:02 · 280 阅读 · 0 评论 -
【HDU 1176 免费馅饼】+ dp
免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 49893 Accepted Submission(s): 17288Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽原创 2017-07-20 17:05:04 · 292 阅读 · 0 评论 -
【Codeforces 629 C Famil Door and Brackets 】+ dp
C. Famil Door and Brackets time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputAs Famil Door’s birthday is coming, some of his friends (原创 2016-12-23 00:00:39 · 575 阅读 · 0 评论 -
【POJ 3071 Football】+ 概率DP
Football Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5015 Accepted: 2557DescriptionConsider a single-elimination football tournament involving 2n teams, denoted 1, 2, …, 2n. I原创 2016-11-21 13:46:58 · 368 阅读 · 0 评论 -
【Codeforces 225C Barcode】+ 动态转移
Barcode Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit StatusDescriptionYou’ve got an n × m pixel picture. Each pixel can be white or black. Your task is to chan原创 2016-11-20 20:00:21 · 587 阅读 · 0 评论 -
【HDU 5904 LCIS + dp】
LCIS Problem Description Alex has two sequences a1,a2,…,an and b1,b2,…,bm. He wants find a longest common subsequence that consists of consecutive values in increasing order.Input There are multiple原创 2016-09-24 22:49:07 · 648 阅读 · 0 评论 -
【Lightoj 1032 Fast Bit Calculations 】
Fast Bit CalculationsDescription A bit is a binary digit, taking a logical value of either 1 or 0 (also referred to as “true” or “false” respectively). And every decimal number has a binary representa原创 2016-09-23 09:54:07 · 488 阅读 · 0 评论 -
【zzulioj 1837 LT说我不服 + dp】
Description对于上一道题目LT不服,表示那么简单的题目不屑于去做,所以我们决定加大一下题目的难度,下面是我们LT出的题目: 假如给你一个由n个数组成的序列A1, A2, A3, A4 …… An。你可以选择任意一个大小的区间,将其中的每一个数x变成(x*1888+101)%14507。 求这n个数的最大和可能是多少。 Input输入有多组数据 每组数据第一行输入一个整数n为序列元素原创 2016-09-12 09:07:41 · 392 阅读 · 0 评论 -
【HDU 杭电 2059 龟兔赛跑】
龟兔赛跑Problem Description 据说在很久很久以前,可怜的兔子经历了人生中最大的打击——赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。 最近正值HDU举办50周年校庆,社会各大名流齐聚下沙,兔子也趁此机会向乌龟发起挑战。虽然乌龟深原创 2016-08-08 23:21:42 · 497 阅读 · 0 评论 -
【POJ 1745 Divisibility】
DivisibilityDescriptionConsider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmetical expressions that evaluate to dif原创 2016-08-08 21:54:08 · 412 阅读 · 0 评论 -
【HDU 杭电 1176 免费馅饼】
免费馅饼Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏原创 2016-08-08 20:40:59 · 432 阅读 · 0 评论 -
【HDU 杭电 1231 最大连续子序列】
最大连续子序列Problem Description 给定K个整数的序列{ N1, N2, …, NK },其任意连续子序列可表示为{ Ni, Ni+1, …, Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和 为原创 2016-08-08 19:36:02 · 320 阅读 · 0 评论 -
【HDU 杭电 1003 Max Sum】
Max SumProblem Description Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5原创 2016-08-08 19:32:24 · 388 阅读 · 0 评论 -
【HDU 杭电 1260 Tickets】
TicketsProblem Description Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could原创 2016-08-08 19:21:13 · 421 阅读 · 0 评论 -
【HDU 2571 命运 +dp】
命运 Problem Description 穿过幽谷意味着离大魔王lemon已经无限接近了! 可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑! 可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧! 命运大迷宫可以看成是一个两维的方格阵原创 2016-09-22 08:12:10 · 377 阅读 · 0 评论 -
【POJ 3688 Cheat in the Game】+ dp + 巴什博弈
DescriptionAlice and Bob are playing a game. At the beginning, the judge takes out a stone pile of W stones and a black box containing N cards. Every card has a number Ai on it. Alice and Bob takes tur原创 2016-10-06 10:59:22 · 458 阅读 · 0 评论 -
【POJ 3624】 + 01背包 + dp
DescriptionBessie has gone to the mall’s jewelry store and spies a charm bracelet. Of course, she’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm原创 2016-10-05 16:58:00 · 374 阅读 · 0 评论 -
【HDU 2196 】+ 直径 + 权值更新
Problem Description A school bought the first computer some time ago(so this computer’s id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of原创 2016-10-02 22:16:54 · 528 阅读 · 0 评论 -
【OpenJ_Bailian 4120】 + dp
硬币 Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u SubmitStatusDescription 宇航员Bob有一天来到火星上,他有收集硬币的习惯。于是他将火星上所有面值的硬币都收集起来了,一共有n种,每种只有一个:面值分别为a1,a2… an。 Bob在机场看到了一个特别原创 2016-10-02 16:53:34 · 592 阅读 · 3 评论 -
【LightOJ 1068 】+ dp
An integer is divisible by 3 if the sum of its digits is also divisible by 3. For example, 3702 is divisible by 3 and 12 (3+7+0+2) is also divisible by 3. This property also holds for the integer 9.In原创 2016-10-02 11:07:19 · 478 阅读 · 0 评论 -
【LightOJ 1064 】Throwing Dice + dp
Throwing Dice n common cubic dice are thrown. What is the probability that the sum of all thrown dice is at least x?Input Input starts with an integer T (≤ 200), denoting the number of test cases.Eac原创 2016-10-02 09:30:42 · 609 阅读 · 0 评论 -
【LightOJ 1122 + dp】
Description Given a set of digits S, and an integer n, you have to find how many n-digit integers are there, which contain digits that belong to S and the difference between any two adjacent digits is原创 2016-10-01 18:59:15 · 1205 阅读 · 0 评论