自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 资源 (1)
  • 收藏
  • 关注

原创 HDU1015Safecracker——水题

=== Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his factory, were destroyed in World War II. Fortunately o

2015-09-11 23:39:13 521

原创 uva103Stacking Boxes——dp

Some concepts in Mathematics and Computer Science are simple in one or two dimensions but become more complex when extended to arbitrary dimensions. Consider solving differential equations in several dimensions and analyzing the topology of an n-dimensiona

2015-08-25 20:30:09 442

原创 UVA111History Grading——dp

Many problems in Computer Science involve maximizing some measure according to constraints.Consider a history exam in which students are asked to put several historical events into chronological order. Students who order all the events correctly will rece

2015-08-25 20:27:17 455

原创 UVA10131Is Bigger Smarter?——dp动态转移方程

Some people think that the bigger an elephant is, the smarter it is. To disprove this, you want to takethe data on a collection of elephants and put as large a subset of this data as possible into a sequenceso that the weights are increasing, but the IQ’

2015-08-25 15:05:49 493

原创 强连通即模板题HDU269

为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请你写个程序确认一下是否任意两个房间都是相互连通的,即:对于任意的i和j,至少存在一条路径可以从房间i到房间j,也存在一条路径可以从房间j到房间i。

2015-08-25 14:49:59 383

原创 HDU1142——A Walk Through the Forest(spfa+记忆化搜索)

Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office is on one side of a forest, and his house is on the other. A

2015-07-31 14:24:14 477

原创 HDU2124——Repair the Wall(贪心水题)

Long time ago , Kitty lived in a small village. The air was fresh and the scenery was very beautiful. The only thing that troubled her is the typhoon.When the typhoon came, everything is terrible. It kept blowing and raining for a long time. And what mad

2015-07-28 17:53:42 729

原创 HDU2111——Saving HDU(贪心)

话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了。显然,作为多年拼搏的商人,XHD不会坐以待毙的。 一天,当他正在苦思冥想解困良策的时候,突然想到了自己的传家宝,那是公司成立的时候,父亲作为贺礼送来的一个锦囊,徐父当时交代,不到万不得已的时候,不要打开它。“现在不正是最需要的时候吗?”,一边想,XHD一边找到了这个精心保管的锦囊,打开一看,里面只有一句话“杭城北麓千人洞有宝”。 二话不说,XHD拿起一个大口袋就出发了,这个千人洞他是知道的,小的时候,爸爸曾经带他来过这个隐蔽的路口

2015-07-28 15:51:02 612

原创 HDU1050——Moving Tables(贪心)

The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes moving a lot of tables between rooms. Because the corridor is narrow and all the tables are big, on

2015-07-28 14:40:49 640

原创 HDU1052——田忌赛马(贪心)

Here is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.""Both of Tian and the king have three horses in different classes,

2015-07-27 18:05:58 830

原创 HDU1058——Humble Numbers

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 first 20 humble numbers. Write a program to find and print the nth element in th

2015-07-25 15:55:26 481

原创 HDU1257——最少拦截系统(贪心)

某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统

2015-07-24 09:07:43 429

原创 HDU1800——Flying to the Mars(map+贪心)

In the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow who ruling the Mars . Here the problem comes! How can the soldiers reach the Mars ?

2015-07-23 10:30:36 622

转载 区间覆盖,选点

1)区间完全覆盖问题问题描述:给定一个长度为m的区间,再给出n条线段的起点和终点(注意这里是闭区间),求最少使用多少条线段可以将整个区间完全覆盖样例:区间长度8,可选的覆盖线段[2,6],[1,4],[3,6],[3,7],[6,8],[2,4],[3,5]解题过程:1将每一个区间按照左端点递增顺序排列,拍完序后为[1,4],[2,4],[2,6],[3,5

2015-07-22 16:18:25 482

原创 HDu1116——Play on Words(并查集+欧拉路径)

Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very important for us. There is a large number of magnetic plat

2015-07-22 10:44:14 480

原创 hdu1217——Arbitrage(flody)

Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British pound, 1 British pound buys 10.0 French francs, and 1

2015-07-21 17:30:35 441

原创 HDU2112——HDU Today(map容器+spfa)

经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在什么地方下车(其实徐总自己有车,却一定要与民同乐,这就是徐总的性格)。徐总经常会问蹩脚的英文问路:“Can you help me?”。看着他那迷茫而又无

2015-07-21 14:22:29 519

原创 HDU3790——最短路径问题(spfa)

给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。

2015-07-21 09:26:42 761 1

原创 ACM之路的高一下学期

期末来临,实验室给我们放假方便大家复习这学期的知识应对考试。在这之前,经过好几天的考试,实验室T掉了一部分人,很少但是很幸运不包括我,虽然暂时留在实验室了,但是我还能走多久我真的不知道,这学期的暑假培训真的至关重要,如果学不好,下学期可能被大一的虐,后果不堪设想啊。这几天我考虑明白一件事,之前为了实验室感觉放弃了做其他事情的时间,但是在实验室的回报却没有那么多,仔细想了一想,那些时间我也并

2015-07-02 20:15:09 589

原创 hdu2544最短路——Dijkstra

模板题

2015-06-20 19:47:53 438

原创 hdu2544最短路——spfa

简单地spfa

2015-06-20 09:13:44 404

原创 hdu1548A strange lift——最短路(迪杰斯特拉,spfa)。bfs(队列。数组)

Dijkstra+spfa+数组模拟队列+bfs,

2015-06-20 07:34:47 552

原创 HDU1198Farm Irrigation——并查集

题意:就是找在整个地图中有多少个连通的水管;思路:先判断是否连通,然后再判断是否需要连接;因为只是判断相邻片段的水管是否连通,所以在存放的时候用0和1来代表总结:这道题有一个小细节,就是如果用并查集存的话,需要注意,一个片段是可以重复使用的,所以如果用编号存根节点的话一定是不对的,所以要用片段在地图上的位置来判断根节点。还有就是一般情况下,数组的开头都用1,把零空出来,会好理解一些

2015-06-08 19:41:11 467

原创 hdu1301——Jungle Roads——最小生成树

简单地最小生成树,一AThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to

2015-06-03 20:37:25 673

原创 hdu3371——最小生成数

坑啊,超时加爆栈,WA了好多次,一次一次的试验下终于解决了,挺爽,再看代码真是挺简单,

2015-06-03 20:06:13 609

原创 hdu2082找单词——母函数

#include#includeint main(){int c1[55];int c2[55];int num[30]={0};int times;scanf("%d",&times);while(times--){for(int i=1;i{scanf("%d",&num[i]);}memset(c2,0,sizeof(c2));

2015-06-02 20:43:59 499

转载 母函数知识点,感觉讲的还可以

母函数(Generating function)详解— Tanky Woo在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。母函数可分为很多种,包括普通母函数、指数母函数、L级数、贝尔级数和狄利克雷级数。对每个序列都可以写出以上每个类型的一

2015-06-02 19:31:04 374

原创 hdu1028——母函数

就是母函数的模板,敲上就能过,我还没弄明白母函数,希望用题来理解吧#include#include#includeint main(){int c1[150];int c2[150];int n;while(scanf("%d",&n)!=EOF){for(int i=0;i{c1[i]=1;c2[i]=0;}for(int i=2;i

2015-06-02 19:28:49 417

原创 hdu1009FatMouse' Trade--水题

FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse do

2015-06-02 14:19:39 477

原创 hdu2066一个人的旅行——最短路(多起点,多终点)

题意:中文题,不说了;思路,和一个起点的差不多,就是有多少个起点一下子全都推进去,然后就是一个起点了;代码::#include#include#include#include#include#define inf 100000000using namespace std;struct node{int to,next,weight;}city[1

2015-06-01 22:19:39 1361

转载 前向星

我们首先来看一下什么是前向星.前向星是一种特殊的边集数组,我们把边集数组中的每一条边按照起点从小到大排序,如果起点相同就按照终点从小到大排序,并记录下以某个点为起点的所有边在数组中的起始位置和存储长度,那么前向星就构造好了.那么对于下图:我们输入边的顺序为:1 22

2015-06-01 18:48:46 665

原创 hdu1874畅通工程续——最短路(Dijkstra算法)(spfa算法)

某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。

2015-05-31 18:07:15 519

原创 变强真的很难么?

做出这个决定,感到深深的无力感。感觉时间太长了些,平以往的经验,我认为我做不到的。但是我真的想坚持一次。现在实验室的人太多了,要踢掉8个人,我感觉我在黑名单之内,所以我要通过实力把自己从黑名单里拉出来。原计划从六月一日,到七月一日奋斗一个月,但是感觉并不能说明什么。纠结了一上午,考虑要不要一直坚持饱满的精神状态,一直到暑假培训结束(意味着时间变成了两倍还要多),我怕时间太久,我会淡忘这

2015-05-31 13:34:14 482

原创 hdu1325Is It A Tree?——基础并查集(考思路)

A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties. There is exactly one node, called the root, to which no direct

2015-05-28 20:26:21 1334

原创 hdu1875畅通工程再续——基础并查集

简单的并查集,很好做哦相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小岛之间有路通即可。其中桥的价格为 100元/米。

2015-05-27 18:55:07 1596

原创 hdu1162Eddy's picture——最小生成树

最小生成时,比较动脑的,可以尝试自己写一写,这有详解;Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictures to let his friends appreciate. but the resul

2015-05-22 21:08:06 418

原创 hdu1102 Constructing Roads------最小生成树

详细题解在这里:There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if there is a road between A and B, or there exist

2015-05-21 19:54:08 442

原创 hdu1233---还是畅通工程 最小生成树(水)

某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。

2015-05-20 22:47:05 430

原创 最近没做题啊

这周一开始军训了,更忙更累了,晚上还去实验室,也是碰见了没见过的题,所以好几天没做题了。从今天开始开始做最小生成树的题了。

2015-05-15 20:04:32 408

原创 再水一道并查集,hdu1856

Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements.Mr Wang selected a room big enough to hold the boys. The boy who are not been c

2015-05-08 19:24:43 400

dhu本地题库

本地hdu,可以无限做杭电题,用着还可以

2015-04-05

空空如也

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

TA关注的人

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