自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Alex_McAvoy的博客

想要成为渔夫的猎手

  • 博客(120)
  • 收藏
  • 关注

原创 Proud Merchants(HDU-3466)

Problem Description Recently, 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 people in this country are still v...

2018-03-31 21:41:58 240

原创 I NEED A OFFER!(HDU-1203)

Problem Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估...

2018-03-31 21:39:18 976

原创 Robberies(HDU-2955)

Problem 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 decided...

2018-03-31 21:36:50 258

转载 动态规划 —— 背包问题 P02 —— 完全背包

【概述】完全背包问题也是一个相当基础的背包问题,它有两个状态转移方程,分别在“基本思路”以及“O(VN)的算法“的小节中给出。【题目】有N种物品和一个容量为V的背包,每种物品都有无限件可用。第i种物品的体积是w[i],价值是c[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。【基本思路】这个问题非常类似于01背包问题,所不同的是每种物品有无限件...

2018-03-31 11:22:56 928

转载 动态规划 —— 背包问题 P01 —— 0-1背包

【概述】 0-1背包问题是最基本的背包问题,它包含了背包问题中设计状态、方程的最基本思想,另外,别的类型的背包问题往往也可以转换成0-1背包问题求解。特点:每种物品仅有一件,可以选择放或不放。【题目】有N件物品和一个容量为V的背包。第i件物品的体积是w[i],价值是c[i]。求解将哪些物品装入背包可使价值总和最大。【基本思路】子问题:将前i件物品放入容...

2018-03-31 10:27:22 909

原创 动态规划 —— 背包问题

【概述】 背包问题(Knapsack problem)是一种组合优化的NP完全问题。问题可以描述为:给定一组物品,每种物品都有自己的重量和价格,在限定的总重量内,我们如何选择,才能使得物品的总价格最高。问题的名称来源于如何选择最合适的物品放置于给定背包中。也可以将背包问题描述为决定性问题,即:在总重量不超过W的前提下,总价值是否能达到V?【分类】P01 0...

2018-03-31 10:02:18 1932

原创 Coins(HDU-2844)

Problem Description Whuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch i...

2018-03-30 23:19:00 288

原创 Dividing(HDU-1059)

Problem Description Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all t...

2018-03-30 23:18:54 227

原创 Big Event in HDU(HDU-1171)

Problem Description Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Sof...

2018-03-30 23:15:18 229

原创 Piggy-Bank(HDU-1114)

Problem Description 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). ...

2018-03-30 23:12:46 265 1

原创 Bone Collector(HDU-2602)

Problem 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 to the gr...

2018-03-30 23:10:20 348

原创 统计问题(HDU-2563)

Problem Description 在一无限大的二维平面中,我们做如下假设:每次只能移动一格 不能向后走(假设你的目的地是“向上”,那么你可以向左走,可以向右走,也可以向上走,但是不可以向下走) 走过的格子立即塌陷无法再走第二次求走n步不同的方案数(2种走法只要有一步不一样,即被认为是不同的方案)。Input 首先给出一个正整数C,表示有C组测试数据...

2018-03-29 20:02:35 414

原创 Bitset(HDU-2051)

Problem DescriptionGive you a number on base ten,you should output it on base two.(0<=n<=1000)InputFor each case there is a postive number n on base ten, end of file.OutputFor each c...

2018-03-29 19:59:49 289

原创 折线分割平面(HDU-2050)

Problem Description 我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。Input 输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=10000),表示折线...

2018-03-29 19:57:50 280

原创 母牛的故事(HDU-2018)

Problem Description 有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input 输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0<n<55),n的含义如题目中描述。<br>n=0表示输入数据的结束,不做处理。Output...

2018-03-29 19:52:54 587

原创 骨牌铺方格(HDU-2046)

Problem Description 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数.例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图:Input 输入数据由多行组成,每行包含一个整数n,表示该测试实例的长方形方格的规格是2×n (0<n<=50)。Output 对于每个...

2018-03-29 19:50:52 451

原创 一只小蜜蜂(HDU-2044)

Problem Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。其中,蜂房的结构如下所示。Input 输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0<a<b<50)。Output 对于每个测试实例,...

2018-03-27 23:36:41 497

原创 超级楼梯(HDU-2040)

Problem Description 有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?Input 输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1&lt;=M&lt;=40),表示楼梯的级数。Output 对于每个测试实例,请输出不同走法的数量Sample Input2...

2018-03-27 23:34:41 1206

原创 命运(HDU-2571)

Problem Description 穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑!可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧!命运大迷宫可以看成是一个两维的方格...

2018-03-27 23:32:16 366

原创 免费馅饼(HDU-1176)

Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在...

2018-03-27 23:28:20 562

原创 数塔(HDU-2084)

Problem Description 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input 输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 ...

2018-03-27 23:25:59 540

原创 Monkey and Banana(HDU-1069)

Problem Description 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...

2018-03-26 20:44:55 1603

原创 Humble Numbers(HDU-1058)

Problem 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, ... shows the ...

2018-03-26 20:42:53 264

原创 Super Jumping! Jumping! Jumping!(HDU-1087)

Problem Description 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 t...

2018-03-26 20:40:59 598

原创 Common Subsequence(HDU-1159)

Problem Description A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = &lt;x1, x2, ..., xm&gt;,another sequence Z = &lt;z1, ...

2018-03-26 20:37:04 373

原创 Max Sum(HDU-1003)

Problem 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 + ...

2018-03-26 20:31:41 904

原创 动态规划 —— 动态规划概述

【概述】动态规划:解决多阶段决策问题的一种方法。实际上就是一种排除重复计算的算法,更具体的说,动态规划就是用空间换取时间。 多阶段决策问题:若一类问题的求解过程可分为若干个互相联系的阶段,在每一个阶段都需作出决策,并影响到下一个阶段的决策。这类问题的解决,就是要在可以选择的那些策略间,选一个最优策略,使在预定的标准下达到最好的效果。 阶段:将所给求解问题的过程恰当地分成若干个相互联系的阶段...

2018-03-26 20:26:59 2625

原创 搜索 —— 深度优先搜索(DFS)

【概述】深度优先搜索,是从初始状态起,利用一定的规则生成搜索树,寻找下一层任一个结点,检查是否出现目标状态,若未出现,以此状态利用规则生成再下一层任一个结点,再检查,重复过程一直到叶节点(即不能再生成新状态节点),当它仍不是目标状态时,回溯到上一层结果,取另一可能扩展搜索的分支。采用相同办法一直进行下去,直到找到目标状态为止。状态必须在遍历完所有它的子状态之后,才能继续进行对同一层中下一个...

2018-03-20 23:57:40 2867

原创 Sequence Two(HDU-2611)

Problem DescriptionSearch is important in the acm algorithm. When you want to solve a problem by using the search method, try to cut is very important.Now give you a number sequence, include n (&...

2018-03-19 19:50:20 414

原创 Sudoku Killer(HDU-1426)

Problem Description自从2006年3月10日至11日的首届数独世界锦标赛以后,数独这项游戏越来越受到人们的喜爱和重视。据说,在2008北京奥运会上,会将数独列为一个单独的项目进行比赛,冠军将有可能获得的一份巨大的奖品———HDU免费七日游外加lcy亲笔签名以及同hdu acm team合影留念的机会。所以全球人民前仆后继,为了奖品日夜训练茶饭不思。当然也包括初学者l...

2018-03-19 19:38:27 369

原创 Sequence One(HDU-2610)

Problem Description Search is important in the acm algorithm. When you want to solve a problem by using the search method, try to cut is very important.Now give you a number sequence, incl...

2018-03-19 19:35:51 782

原创 Another Eight Puzzle(HDU-2514)

Problem DescriptionFill the following 8 circles with digits 1~8,with each number exactly once . Conntcted circles cannot be filled with two consecutive numbers.There are 17 pairs of connected cic...

2018-03-19 19:32:23 234

原创 Pusher(HDU-2821)

Problem Description PusherBoy is an online game http://www.hacker.org/push . There is an R * C grid, and there are piles of blocks on some positions. The goal is to clear the blocks by pushing i...

2018-03-19 19:28:57 449

原创 The magic apple tree(HDU-3290)

Problem DescriptionSailormoon girls all like eating many kinds of fruit, such as banana, grape, apple and so on.One day, when they was walking on a orchard, they found a magic apple tree.The magi...

2018-03-19 19:25:39 404

原创 Prime Ring(HDU-1016)

Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime....

2018-03-19 19:23:17 240

原创 Tempter of the Bone(HDU-1010)

Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. ...

2018-03-19 19:20:32 392

原创 非常可乐(HDU-1495)

Problem Description 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N毫升和M毫升 可乐的体积为S毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 ...

2018-03-19 19:17:37 404

原创 理论基础 —— 排序 —— 堆排序

【概述】堆排序是一种不稳定的排序方法,其利用了堆的性质来进行排序,是选择排序的一种。其基本思想是:将待排序的记录构成一个堆,然后不断将堆顶元素移走,并将剩余的记录调整成堆,直到堆空。关于堆:点击这里【实现过程】堆排序的实现步骤为:根据已有序列创建一个堆 heap[0..n-1] 堆首元素移除堆并加入至有序区,同时,将堆的尺寸缩小 1 将剩下的数据重新调整成堆,重复步骤...

2018-03-18 14:53:01 614

原创 A strange lift(HDU-1548)(dfs实现)

Problem Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and d...

2018-03-18 11:06:18 438 1

原创 A strange lift(HDU-1548)(bfs实现)

Problem Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and d...

2018-03-18 11:03:37 457

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除