ACM_HDU
文章平均质量分 69
nirvana · rebirth
NIRVANA & REBIRTH
展开
-
HDU 5925——Coconuts【离散化 + 求连通块】(2016 东北赛D题)
Problem DescriptionTanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams about eating. One day, TanBig dreams of a field of coconuts, and the field looks like a large chessboard which has R rows and C columns. In every cell of the原创 2021-05-09 14:37:49 · 286 阅读 · 0 评论 -
HDU 1875——畅通工程再续【最小生成树 && Prime堆优化】
Problem Description相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小岛之间有路通即可。其中桥的价格为 100元/米。Input输入包括原创 2021-04-29 20:18:43 · 162 阅读 · 0 评论 -
HDU 2089——不要62【数位DP】
题目传送门Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有...转载 2020-02-10 10:45:04 · 358 阅读 · 0 评论 -
HDU 2044——一只小蜜蜂...【递推】
添加链接描述Problem Description有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。其中,蜂房的结构如下所示。Input输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0<a<b<50)。Output对于每个测试实例,请输出蜜蜂从蜂房a爬到蜂房b...原创 2019-11-27 23:49:53 · 269 阅读 · 0 评论 -
HDU 2018——母牛的故事【递推】
添加链接描述Problem Description有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0<n<55),n的含义如题目中描述。n=0表示输入数据的结束,不做处理。Output对于每个测试实例,输出在第n...原创 2019-11-27 23:42:15 · 244 阅读 · 0 评论 -
HDU 2084——数塔【简单递推】
题目传送门Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 <= N <= 1...原创 2019-11-27 23:06:57 · 219 阅读 · 0 评论 -
HDU 1698——Just a Hook【线段树 & 区间修改 & 区间查询 & 维护区间和】
题目传送门Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of th...原创 2019-11-20 23:55:10 · 169 阅读 · 0 评论 -
HDU 2795——Billboard【线段树 & 单点更新 & 维护区间最大值】
题目传送门Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announce...原创 2019-11-19 16:39:45 · 169 阅读 · 0 评论 -
HDU 1394——Minimum Inversion Number【线段树 & 逆序数】
题目传送门Problem DescriptionThe inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i < j and ai > aj.For a given sequence of numbers a1, a2, …...原创 2019-11-19 15:50:37 · 161 阅读 · 0 评论 -
HDU 1754——I Hate It【线段树 & 维护区间最大值】
题目传送门Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N...原创 2019-11-19 14:25:46 · 160 阅读 · 0 评论 -
HDU 1166——敌兵布阵【线段树】
题目传送门Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C...原创 2019-11-19 14:00:22 · 221 阅读 · 0 评论 -
HDU 4003——Find Metal Mineral【树形DP & 类树形背包变形】
题目传送门Problem DescriptionHumans have discovered a kind of new metal mineral on Mars which are distributed in point‐like with paths connecting each of them which formed a tree. Now Humans launches k ...原创 2019-11-18 19:56:01 · 422 阅读 · 0 评论 -
HDU 1561——The more, The Better【树形背包 & 构建虚结点】
题目传送门Problem DescriptionACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多的宝物应该攻克哪M个城堡吗?Input每个测试实例首先包括2个整数,N,M.(1 ...原创 2019-11-18 00:46:44 · 170 阅读 · 0 评论 -
HDU 1011——Starship Troopers【树形背包】
添加链接描述Problem DescriptionYou, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base is built underground. It is actually a huge cavern, which consists of many rooms conn...原创 2019-11-18 00:28:17 · 220 阅读 · 0 评论 -
HDU 4745——Two Rabbits【区间DP & 最长回文子序列】
题目传送门Problem DescriptionLong long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny afternoon, they planned to play a game with some stones. There were n stones on the ground and...原创 2019-11-11 00:43:09 · 282 阅读 · 0 评论 -
HDU 2196——Computer【树形DP】
题目传送门Problem DescriptionA 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...原创 2019-11-05 00:42:39 · 264 阅读 · 0 评论 -
HDU 1520——Anniversary party【树形DP】
题目传送门Problem DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the sup...原创 2019-11-04 22:09:58 · 191 阅读 · 0 评论 -
HDU 3506——Monkey Party【区间DP & 四边形不等式优化】
题目传送门Problem DescriptionFar away from our world, there is a banana forest. And many lovely monkeys live there. One day, SDH(Song Da Hou), who is the king of banana forest, decides to hold a big par...原创 2019-11-02 23:32:13 · 248 阅读 · 0 评论 -
HDU 1159——Common Subsequence【LCS最长公共子序列】
题目传送门Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, …, xm> another sequence Z = <z1, ...原创 2019-10-31 23:30:20 · 219 阅读 · 0 评论 -
HDU 1503——Advanced Fruits【LCS最长公共子序列变形 & 合并字符串 & 还原路径】
题目传送门Problem DescriptionThe company “21st Century Fruits” has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times this method...原创 2019-10-31 23:24:41 · 365 阅读 · 0 评论 -
HDU 1087——Super Jumping! Jumping! Jumping!【最长上升序列和 & 动态规划】
题目传送门Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it...原创 2019-10-31 14:05:16 · 177 阅读 · 1 评论 -
HDU 1003——Max Sum【最大子序列和】
题目传送门Problem DescriptionGiven 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 ...原创 2019-10-31 13:52:12 · 212 阅读 · 0 评论 -
HDU 3033——I love sneakers!【分组背包变形】【数据 & 条件的透彻分析】
题目传送门分组背包变形,每组都需要选,组内随便选Problem DescriptionAfter months of hard working, Iserlohn finally wins awesome amount of scholarship. As a great zealot of sneakers, he decides to spend all his money on th...原创 2019-10-30 00:22:28 · 186 阅读 · 0 评论 -
HDU 1712—— ACboy needs your help【分组背包】
题目传送门选课复习问题,没门课只能选一次,找个时间复习,求最大的收益。每门课对应一组,每个时间对应一个物品。Problem DescriptionACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from differe...原创 2019-10-29 10:18:11 · 262 阅读 · 0 评论 -
HDU 2191——悼念512汶川大地震遇难同胞——珍惜现在,感恩生活【多重背包 & 二进制优化】
题目传送门Problem Description急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。请问:你用有限的资金最多能采购多少公斤粮食呢?后记:人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。月有阴晴圆缺,...原创 2019-10-27 13:49:16 · 189 阅读 · 0 评论 -
HDU 1059——Dividing【多重背包 & 二进制优化】
题目传送门简单多重背包,体积为硬币数,价值为币值,可用二进制处理成01背包求解,可用30对num进行优化。Problem DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equa...原创 2019-10-27 13:25:57 · 190 阅读 · 0 评论 -
HDU 1114——Piggy-Bank【完全背包 & 恰好装满】
题目传送门Problem DescriptionBefore ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM)...原创 2019-10-27 12:10:48 · 298 阅读 · 0 评论 -
HDU 2126——Buy the souvenirs【01背包 + 种类数】
题目传送门Problem DescriptionWhen the winter holiday comes, a lot of people will have a trip. Generally, there are a lot of souvenirs to sell, and sometimes the travelers will buy some ones with pleasur...原创 2019-10-26 18:20:22 · 270 阅读 · 0 评论 -
HDU 3466——Proud Merchants【01背包 + 排序消除后效性】
题目传送门与顺序有关的01背包,先按q-p排序再来处理,难想容易敲。Problem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the pe...原创 2019-10-26 16:15:14 · 306 阅读 · 0 评论 -
HDU 2639——Bone Collector II【01背包、第k优解】
题目传送门求价值第K大的01背包问题,技巧是多加一维表示第k大时的价值,转移的时候用两个有序数列合并的方法不断更新第二维。Problem DescriptionThe title of this problem is familiar,isn’t it?yeah,if you had took part in the “Rookie Cup” competition,you must ha...原创 2019-10-25 00:24:50 · 361 阅读 · 0 评论 -
HDU 2955——Robberies【01背包变形】
题目传送门抢劫方案最优问题,需要一个简单地转换,我们求的是不被抓的概率而非被抓的概率,各个银行的储蓄总和为背包容量,体积为单个银行的储蓄,价值为不被抓概率。Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually g...原创 2019-10-25 00:06:12 · 414 阅读 · 0 评论 -
HDU 2546——饭卡【01背包 + 贪心】
题目传送门Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。Input...原创 2019-10-24 23:30:36 · 201 阅读 · 0 评论 -
HDU 2050——折线分割平面【递推】
题目传送门Problem Description我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。Input输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=10000),表示折线的数量。...原创 2019-10-22 23:22:48 · 186 阅读 · 0 评论 -
HDU 3308——LCIS【线段树 & 单点更新 & 区间和并 & 维护区间LIS】
题目传送门Problem DescriptionGiven n integers.You have two operations:U A B: replace the Ath number by B. (index counting from 0)Q A B: output the length of the longest consecutive increasing subsequ...原创 2019-11-21 23:55:31 · 351 阅读 · 0 评论