![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
HDU oj
yqdjl6
这个作者很懒,什么都没留下…
展开
-
4372 Count the Buildings(2012 Multi-University Training Contest 8)第一类strling数
Count the BuildingsProblem Description There are N buildings standing in a straight line in the City, numbered from 1 to N. The heights of all the buildings are distinct and between 1 and N. You can s原创 2017-07-07 20:13:55 · 190 阅读 · 0 评论 -
Hdu 6154 CaoHaha's staff
CaoHaha’s staffProblem Description “You shall not pass!” After shouted out that,the Force Staff appered in CaoHaha’s hand. As we all know,the Force Staff is a staff with infinity power.If you can us原创 2017-08-20 02:46:59 · 401 阅读 · 0 评论 -
Hdu 6152 Friend-Graph(Ramsey定理)
Friend-GraphProblem Description It is well known that small groups are not conducive of the development of a team. Therefore, there shouldn’t be any small groups in a good team. In a team with n memb原创 2017-08-20 03:08:44 · 311 阅读 · 0 评论 -
HDU 2084 数塔
数塔Problem Description 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input 输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 <= N <= 100),表示数塔的高原创 2017-08-05 17:03:51 · 160 阅读 · 0 评论 -
HDU 2955 Robberies
RobberiesProblem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has dec原创 2017-08-05 18:08:35 · 140 阅读 · 0 评论 -
Hdu 1978 How many ways(dp)
How many waysProblem Description 这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下: 1.机器人一开始在棋盘的起始点并有起始点所标有的能量。 2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。 3.机器人不能在原地停留。 4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只原创 2017-08-21 02:57:29 · 179 阅读 · 0 评论 -
HDU 1495 & [kuangbin带你飞]专题一 简单搜索 M
M - 非常可乐大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,10原创 2017-07-29 02:21:45 · 207 阅读 · 0 评论 -
动态规划之最长公共子序列(LCS)
最长公共子序列是一个特别常见的动态规划问题,题目的意思是给定两个字符串X,Y,让你求一个字符串Z,使C中的每个字符即属于X,又属于Y,且字符在Z中的顺序必须和X,Y中的顺序是一样的,(这里区分子序列和子串的概念:子序列是不连续的,子串是连续的)举个例子X={A,B,C,B,D,A,B},Y={B.D.C.A.B.A},那么最长的公共序列Z={B,C,B,A}或{B,D,A,B},最朴素的算法就是遍历原创 2017-08-14 15:56:14 · 255 阅读 · 0 评论 -
二分图最大匹配--匈牙利算法
在杭电上做题遇到了二分图最大匹配的问题,然后在网上搜博客的时候搜到了一片超级赞的讲解,3分钟让我看懂了匈牙利算法…博主剪枝太强大了 附上链接: 趣写算法系列之–匈牙利算法 看完这个链接简直不想再写题解了…这个算法就是一个dfs的回溯的过程,当然用bfs也能写,不过用dfs比较好写,看完讲解后贴一道例题Hdu 2603:过山车Problem Description RPG girls今天和大家一原创 2017-09-04 10:59:21 · 227 阅读 · 0 评论 -
HDU 1421 搬宿舍(DP)
搬宿舍Problem Description 搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度原创 2017-08-15 18:29:31 · 209 阅读 · 0 评论 -
HDU 2058 The sum problem
The sum problemProblem Description Given a sequence 1,2,3,……N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M.Input Input contains multiple test cases.原创 2017-08-04 17:55:33 · 164 阅读 · 0 评论 -
HDU 6103 Kirinriki
好久没更博客了,最近好懒….多校打了六场,每场都是稳定输出第一题…然后队友第二题…然后剩下四个多小时死磕第三题…..要好好了努力了KirinrikiProblem Description We define the distance of two strings A and B with same length n is disA,B=∑i=0n−1|Ai−Bn−1−i| The differ原创 2017-08-11 17:06:13 · 218 阅读 · 0 评论 -
[kuangbin带你飞]专题二 搜索进阶 D
D - EscapeThe students of the HEU are maneuvering for their military training. The red army and the blue army are at war today. The blue army finds that Little A is the spy of the red army, so Little原创 2017-07-30 21:56:59 · 245 阅读 · 0 评论 -
HDU 2045 不容易系列之(3)—— LELE的RPG难题
不容易系列之(3)—— LELE的RPG难题Problem Description 人称“AC女之杀手”的超级偶像LELE最近忽然玩起了深沉,这可急坏了众多“Cole”(LELE的粉丝,即”可乐”),经过多方打探,某资深Cole终于知道了原因,原来,LELE最近研究起了著名的RPG难题:有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的原创 2017-08-02 16:52:25 · 181 阅读 · 0 评论 -
HDU6033 & 2017 Multi-University Training Contest - Team 1 A
Add More ZeroProblem Description There is a youngster known for amateur propositions concerning several mathematical hard problems.Nowadays, he is preparing a thought-provoking problem on a specific t原创 2017-07-25 19:05:07 · 323 阅读 · 0 评论 -
HDU6043 & 2017 Multi-University Training Contest - Team 1
KazaQ’s SocksProblem Description KazaQ wears socks everyday.At the beginning, he has n pairs of socks numbered from 1 to n in his closets. Every morning, he puts on a pair of socks which has the small原创 2017-07-25 19:44:02 · 421 阅读 · 0 评论 -
HDU 6034 & 2017 Multi-University Training Contest - Team 1
Balala Power!Problem DescriptionTalented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z int原创 2017-07-25 21:11:44 · 243 阅读 · 0 评论 -
Hdu 6143 Killer Names(第二类strling数)
Killer NamesProblem Description Galen Marek, codenamed Starkiller, was a male Human apprentice of the Sith Lord Darth Vader. A powerful Force-user who lived during the era of the Galactic Empire, Mar原创 2017-08-17 21:54:15 · 302 阅读 · 0 评论 -
HDU6044 & 2017 Multi-University Training Contest - Team 1
Limited PermutationProblem Description As to a permutation p1,p2,⋯,pn from 1 to n, it is uncomplicated for each 1≤i≤n to calculate (li,ri) meeting the condition that min(pL,pL+1,⋯,pR)=pi if and only i原创 2017-07-27 09:44:11 · 271 阅读 · 0 评论 -
HDU 2056 Rectangles
RectanglesProblem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its si原创 2017-08-04 15:16:10 · 198 阅读 · 0 评论 -
HDU6038 & 2017 Multi-University Training Contest - Team 1
FunctionProblem Description You are given a permutation a from 0 to n−1 and a permutation b from 0 to m−1.Define that the domain of function f is the set of integers from 0 to n−1, and the range of it原创 2017-07-27 10:45:28 · 224 阅读 · 0 评论 -
HDU 1058 Humble Numbers
Humble NumbersProblem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, … show原创 2017-08-15 23:45:11 · 222 阅读 · 0 评论 -
Hdu 2062 Subset sequence
Subset sequenceProblem Description Consider the aggregate An= { 1, 2, …, n }. For example, A1={1}, A3={1,2,3}. A subset sequence is defined as a array of a non-empty subset. Sort all the subset sequec原创 2017-09-05 08:59:13 · 252 阅读 · 0 评论 -
Hdu 1058 Humble Numbers
Humble NumbersProblem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, … show原创 2017-08-29 19:07:35 · 196 阅读 · 0 评论 -
Hdu 1789 Doing Homework again
Doing Homework againProblem Description 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原创 2017-08-29 19:20:00 · 219 阅读 · 0 评论 -
Hdu 2059 龟兔赛跑
龟兔赛跑Problem Description 据说在很久很久以前,可怜的兔子经历了人生中最大的打击——赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。 最近正值HDU举办50周年校庆,社会各大名流齐聚下沙,兔子也趁此机会向乌龟发起挑战。虽然乌龟深原创 2017-08-30 13:40:24 · 185 阅读 · 0 评论 -
Hdu 1158 Employment Planning
Employment PlanningProblem Description A project manager wants to determine the number of the workers needed in every month. He does know the minimal number of the workers needed in each month. When h原创 2017-08-30 13:44:04 · 381 阅读 · 0 评论 -
多重背包二进制优化 && Hdu 1059
多重背包有时候遇到大数据的时候是特别慢的,我们这是可以用二进制进行优化,简单的来说,就是假如说有10个价值为2,重量为3的物品,我们可以简化成1个价值为2,重量为3,一个价值为4,重量为6,一个价值为8,重量为12,一个价值为6,重量为9的物品,其实也就相当于把10分成了1,2,4,3的状态,然后进行01背包的计算,因为这四个状态可以组合成从1到10的所有状态,在大数据的时候优化效果明显,附上我的板原创 2017-08-30 23:22:24 · 194 阅读 · 0 评论 -
Hdu 1080 Human Gene Functions(DP)
Human Gene FunctionsProblem Description It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Bi原创 2017-08-31 13:38:27 · 210 阅读 · 0 评论 -
Hdu 1074Doing Homework(状压DP)
Doing HomeworkProblem Description 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 Ignat原创 2017-09-18 13:13:15 · 478 阅读 · 0 评论 -
最长上升子序列问题(LIS)
LIS是动态规划中的一个经典问题,意思是给你一段序列,让你从中按顺序求一个间断的最长的上升子序列 这里有两种方法,一种是复杂度为O(n^2)的方法: 每次选取一个点为终点,我们计算以这个点为终点的最长的长度:#include<bits/stdc++.h>using namespace std;const int maxn=1e3+5;int ans[maxn],dp[maxn];int原创 2017-08-28 21:41:04 · 316 阅读 · 0 评论 -
Hdu 2602 Bone Collector
Bone CollectorProblem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went原创 2017-08-29 18:58:48 · 185 阅读 · 0 评论 -
Hdu 1505 City Game
City GameProblem Description Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in which there are streets,原创 2017-08-29 18:02:55 · 274 阅读 · 0 评论 -
卡特兰数
卡特兰数是一个非常神奇的数列,在组合数学计数问题中经常遇到,卡特兰数最经典的问题是出入栈问题:对于一个无限大的栈,一共n个元素,请问有几种合法的入栈出栈形式?然后我们就引出了卡特兰数列从《编程之美》买票找零问题说起,娓娓道来卡特兰数——兼爬坑指南这里有一个大佬的写的感觉挺好的,我就从一道Hdu的题说一下 Hdu 2067小兔的棋盘Problem Description 小兔的叔叔从外面旅游回来给原创 2017-09-05 17:39:14 · 601 阅读 · 0 评论 -
Hdu 2082 找单词(DP)
找单词Problem Description 假设有x1个字母A, x2个字母B,….. x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,….. 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值<=50的单词呢?单词的价值就是组成一个单词的所有字母的价值之和,比如,单词ACM的价值是1+3+14=18,单词HDU的价值是8+4+21=33。(组成的单词与排列顺序无关,比如AC原创 2017-09-06 13:17:24 · 276 阅读 · 0 评论 -
Hdu 2859 Phalanx
PhalanxProblem Description Today is army day, but the servicemen are busy with the phalanx for the celebration of the 60th anniversary of the PRC. A phalanx is a matrix of size n*n, each element is a原创 2017-09-14 04:11:06 · 284 阅读 · 0 评论 -
Hdu 1025 Constructing Roads In JGShining's Kingdom(DP)
Constructing Roads In JGShining’s KingdomProblem Description JGShining’s kingdom consists of 2n(n is no more than 500,000) small cities which are located in two parallel lines.Half of these cities are原创 2017-08-29 10:11:57 · 279 阅读 · 0 评论 -
最大子阵和(DP)&& Hdu 1003 && Hdu 1081
我们看最大子阵和之前先看一个最长子序列的问题,给你一个数组,让你求出值最大的连续序列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), th原创 2017-08-29 17:09:45 · 273 阅读 · 0 评论 -
Hdu 2955 Robberies
RobberiesProblem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has dec原创 2017-08-29 17:30:00 · 201 阅读 · 0 评论 -
Hdu 1864 最大报销额(DP)
最大报销额Problem Description 现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。Input 测试输入包含若干测试用例。每个测试用例的第1行包含两个正数 Q 和 N,其原创 2017-08-29 17:35:33 · 244 阅读 · 0 评论