
DP
Fly++
不论何时,能依赖到最后的只有自己的强大
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Doing Homework
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after th...原创 2018-04-30 11:02:49 · 372 阅读 · 0 评论 -
Recovering BST(cf505 D)
Dima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees!Recently he found a binary search tree and instinctively nibbled all of its edges, hence messing u...原创 2018-08-24 10:23:53 · 399 阅读 · 0 评论 -
不要62(HDU2089)
Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有6和2,但不...原创 2018-08-06 19:25:56 · 741 阅读 · 0 评论 -
J Beautiful Numbers(上海大都会赛数位dp)
链接: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 integer number is beautiful if and only if it is ...原创 2018-08-06 19:04:39 · 258 阅读 · 0 评论 -
最短Hamilton路径(upc 状压DP)
题目描述给定一张 n(n≤20) 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 的最短Hamilton路径。 Hamilton路径的定义是从 0 到 n-1 不重不漏地经过每个点恰好一次。 输入第一行一个整数n。接下来n行每行n个整数,其中第i行第j个整数表示点i到j的距离(一个不超过10^7的正整数,记为a[i,j])。对于任意的x,y,z,数据保证 ...原创 2018-07-22 10:57:50 · 956 阅读 · 0 评论 -
D - 迷宫 FZU - 2256
某一天,YellowStar在人生的道路上迷失了方向,迷迷糊糊之中,它误入了一座迷宫中,幸运的是它在路口处发现了一张迷宫的地图。经过它的观察,它发现这个迷宫一共有n个房间,并且这n个房间呈现一个有根树结构,它现在所在的1号房间为根,其它每个房间都有一个上级房间,连接第i个房间和它的上级房间Pi的道路长度为Wi。在地图的背面,记载了这个迷宫中,每个房间拥有一个时空传送门,第i个房间的传送门可以花费D...原创 2018-06-03 12:00:10 · 218 阅读 · 0 评论 -
CA Loves GCD
DescriptionCA is a fine comrade who loves the party and people; inevitably she loves GCD (greatest common divisor) too. Now, there are $N$ different numbers. Each time, CA will select several numbers ...原创 2018-05-08 17:54:14 · 328 阅读 · 0 评论 -
过河
Description在河上有一座独木桥,一只青蛙想沿着独木桥从河的一侧跳到另一侧。在桥上有一些石子,青蛙很讨厌踩在这些石子上。由于桥的长度和青蛙一次跳过的距离都是正整数,我们可以把独木桥上青蛙可能到达的点看成数轴上的一串整点:0,1,……,L(其中L是桥的长度)。坐标为0的点表示桥的起点,坐标为L的点表示桥的终点。青蛙从桥的起点开始,不停的向终点方向跳跃。一次跳跃的距离是S到T之间的任意正整数(...原创 2018-05-08 16:13:10 · 471 阅读 · 0 评论 -
Longest Ordered Subsequence
A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence ( a1, a2, ..., aN) be any sequence ( ai1, ai2, ..., aiK), where 1 <= i1 < i2...原创 2018-05-14 22:45:16 · 190 阅读 · 0 评论 -
国王的宴会
DescriptionC国在成果破解J国破坏交通的阴谋之后,国王决定宴请各位大臣,合理制定宴请的人的名单的任务就交给了作为国王智囊团团长的你。你知道国王喜欢热闹,所以你希望能邀请尽量多的人,但是做为直接上下级关系的两个人直接出现在宴会上的时候会显得很尴尬,所以不能同时请有上下级关系的两个人。国王是宴会的主办方,也是这个王国的最高领袖,所以必须到场。为了能为宴会准备的更好,你需要知道整个宴会最多可以...原创 2018-05-14 20:54:29 · 582 阅读 · 0 评论 -
免费馅饼
都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝...原创 2018-04-29 22:38:15 · 199 阅读 · 0 评论 -
Palindrome
DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the m...原创 2018-05-06 16:39:13 · 886 阅读 · 0 评论 -
Monkey and Banana
A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monk...原创 2018-04-26 18:13:38 · 216 阅读 · 0 评论 -
Ignatius and the Princess IV
"OK, you are not too bad, em... But you can never pass the next test." feng5166 says. "I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to tel...原创 2018-04-25 22:03:38 · 172 阅读 · 0 评论 -
Max Sum Plus Plus
Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem. Given ...原创 2018-04-25 21:40:29 · 208 阅读 · 0 评论 -
Tickets
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 he go back home as early as...原创 2018-05-01 10:25:54 · 317 阅读 · 0 评论 -
Piggy-Bank
Before 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). The idea behind is simple...原创 2018-04-30 23:18:30 · 474 阅读 · 0 评论 -
Super Jumping! Jumping! Jumping!
Nowadays, 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 to you now. The game can b...原创 2018-04-30 13:10:23 · 150 阅读 · 0 评论 -
Tree and Permutation (HDU6446)
Problem DescriptionThere are N vertices connected by N−1 edges, each edge has its own length.The set { 1,2,3,…,N } contains a total of N! unique permutations, let’s say the i-th permutation is Pi a...原创 2018-08-29 11:10:48 · 364 阅读 · 0 评论