自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(82)
  • 收藏
  • 关注

原创 AOJ 2249 Road Construction (dijkstra+队列优化)

King Mercer is the king of ACM kingdom. There are one capital and some cities in his kingdom. Amazingly, there are no roads in the kingdom now. Recently, he planned to construct roads between the capi

2018-01-16 00:17:05 445

原创 poj 3268 Silver Cow Party(bellman-Ford+spfa)

One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤X ≤N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way ro

2018-01-15 10:30:29 179

原创 POJ 2139 Six Degrees of Cowvin Bacon(Floyd)

The cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon".The game works like this: each cow is considered to be zero degrees o

2018-01-14 23:15:59 210

原创 hdu 2063 过火车(二分图匹配--hungarian)

Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSno

2018-01-13 23:16:25 237

原创 POJ 2376 Cleaning Shifts(区间贪心)

DescriptionFarmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided th

2018-01-10 00:37:26 199

原创 AOJ 0525 Osenbei(dfs)

题目大意:给你一个n行m列的阵,每个元素要么为1要么为0;你可以翻转一行,也可以翻转一列,现在问你怎么翻转使得1最多?n因为m太大,所以搜一下行即可,每一行要么翻要么不翻,用dfs实现,最后对于每列,不用再枚举了,如果这一列1多的话就不翻转了,1比0少就翻转。代码如下:#include #include #include using namespace std;int

2018-01-08 12:04:57 156

原创 poj 2718 Smallest Difference(dfs枚举水过)

Given a number of distinct decimal digits, you can form one integer by choosing a non-empty subset of these digits and writing them in some order. The remaining digits can be written down in some orde

2017-12-29 21:35:15 189

原创 AOJ 0121 Seven Puzzle (bfs)

题目大意:有一个4*2的方框,里面随机填充着0-7这8个数。每次可以交换相邻的两个格子里的数。比如:可以交换为也可以交换为最终希望8个数整齐地排列为求最小的交换次数。我们用一个struct 来记录状态:struct node{ int a[8]; int time;}然后每一次我们要先找到0的位置然后再更

2017-12-29 11:09:31 206

原创 AOJ 0558 Cheese (BFS)

题目大意:在H * W的地图上有N个奶酪工厂,分别生产硬度为1-N的奶酪。有一只吃货老鼠准备从老鼠洞出发吃遍每一个工厂的奶酪。老鼠有一个体力值,初始时为1,每吃一个工厂的奶酪体力值增加1(每个工厂只能吃一次),且老鼠只能吃硬度不大于当前体力值的奶酪。 老鼠从当前格走到相邻的无障碍物的格(上下左右)需要时间1单位,有障碍物的格不能走。走到工厂上时即可吃到该工厂的奶酪,吃奶酪时间不计。问吃

2017-12-28 14:07:17 180

原创 AOJ0033 Ball(dfs)

日文题就不抄题了。大意是:有一个形似央视大楼(Orz)的筒,从A口可以放球,放进去的球可通过挡板DE使其掉进B裤管或C裤管里,现有带1-10标号的球按给定顺序从A口放入,问是否有一种控制挡板的策略可以使B裤管和C裤管中的球从下往上标号递增。 输入:第一行输入数据组数N。接下来N行为N组具体数据,每组数据中有10个整数,代表球的放入顺序。 输出:对于每组数据,若策略存在,输出

2017-12-27 23:52:18 183

原创 hdu 1083 Courses(二分图匹配)

Problem DescriptionConsider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exa

2016-11-17 19:53:34 255

原创 poj 2239 Selecting Courses(二分图匹配)

DescriptionIt is well known that it is not easy to select courses in the college, for there is usually conflict among the time of the courses. Li Ming is a student who loves study every much, and at

2016-11-17 13:09:54 193

原创 hdu 1500 Chopsticks (dp)

DescriptionIn China, people use a pair of chopsticks to get food on the table, but Mr. L is a bit different. He uses a set of three chopsticks -- one pair, plus an EXTRA long chopstick to get some b

2016-08-01 16:17:55 285

原创 poj 2457(spfa+路径保存)

问题描述The cows have been sent on a mission through space to acquire a new milking machine for their barn. They are flying through a cluster of stars containing N (1 <= N <= 50,000) planets, each wit

2016-07-29 17:55:13 362

原创 hdu 1598 find the most comfortable road(并查集+贪心)

Problem DescriptionXX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提

2016-07-29 16:53:35 234

原创 poj 1062 昂贵的聘礼 (dijkstra)

Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换

2016-07-29 15:53:32 232

原创 poj 2836 Rectangular Covering(状压dp)

问题描述n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covered by

2016-07-15 16:18:21 250

原创 Wormholes poj 3259 (bellman-floyd+spfa)

问题描述While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a t

2016-06-27 12:52:12 242

原创 Six Degrees of Cowvin Bacon poj 2131(floyd)

问题描述The cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon".The game works like this: each cow is considered to be zero d

2016-06-27 10:45:28 273

原创 Washing Clothes poj 3211(01背包)

问题描述Dearboy was so busy recently that now he has piles of clothes to wash. Luckily, he has a beautiful and hard-working girlfriend to help him. The clothes are in varieties of colors but each pi

2016-06-26 19:23:22 331

原创 Cash Machine poj 1276(多重背包)

问题描述A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, s

2016-06-26 17:18:15 172

原创 poj 1014(多重背包讲解)

问题描述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 the marbles had th

2016-06-26 15:07:04 753 2

原创 Space Elevator poj 2392(多重背包)

问题描述The cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 <= K <= 400) different types of blocks with which to build

2016-06-25 21:08:27 179

原创 Making the Grade poj 3666(离散化+滚动数组+dp)

问题描述A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not mind climbing up or down a single slope, but they are not fond of a

2016-06-25 19:20:27 249

原创 poj 3280 Cheapest Palindrome(区间dp)

问题描述Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system will read as the co

2016-06-21 19:49:38 187

原创 Milking Time --poj 3616(区间dp)

问题描述Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her nextN (1 ≤ N ≤ 1,000,000) hours (conveniently labeled 0..N-1

2016-06-21 10:41:58 254

原创 Apple Catching poj 2385(简单dp)

问题描述It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples whe

2016-06-19 19:44:29 433

原创 hdu 2795 Billboard(线段树)

问题描述At 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 announcements are posted: n

2016-05-08 14:40:39 247

原创 poj 2777 Count Color(线段树区间更新+位运算)

问题描述Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.There is a very long board with length L cent

2016-04-30 13:56:58 196

原创 poj 3185

问题描述The cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing cool water) or upside-down (a position which holds no

2016-04-12 15:55:50 298

原创 poj 3669 Meteor Shower(bfs)

问题描述Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her

2016-04-07 22:16:34 161

原创 poj 2184 Cow Exhibition

问题描述"Fat and docile, big and dumb, they look so stupid, they aren't muchfun..." - Cows with Guns by Dana Lyons The cows want to prove to the public that they are both smart and fun. In o

2016-04-04 12:18:13 221

原创 poj 3190 Stall Reservations(贪心)

问题描述Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A..B (1 <= A <= B <= 1,000,000), which includes both times A and B

2016-04-03 10:18:23 240

原创 AOJ 0118 Property Distribution(dfs 求连通块)

由于是日问题就不抄题了。题目大意是给你一个矩形区域,每个小块可以种三种树,求联通量的个数。这里我用的是一个vis数组来记录状态,这也是通常做法。但是如果为了节省空间的话可以遍历过的都变成‘0’,然后dfs遇到0就return ;这样空间能节省不少。代码如下:#include #include #include using namespace std;char ma[1

2016-03-29 23:30:18 332

原创 poj 2393 Yogurt factory

问题描述The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate weekly such that it will cos

2016-03-22 08:37:26 581

原创 poj 3050 Hopscotch(暴力dfs)

问题描述The cows play the child's game of hopscotch in a non-traditional way. Instead of a linear set of numbered boxes into which to hop, the cows create a 5x5 rectilinear grid of digits parallel to

2016-03-21 09:32:09 230

原创 poj 2387 Til the Cows Come Home(Dijkstra)

问题描述Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants

2016-03-17 22:21:02 163

原创 poj 3264 Balanced Lineup(线段树)

问题描述For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To ke

2016-03-17 13:01:20 157

原创 Aizu - 0189 Convenient Location(floyd)

问题描述来春卒業するAさんは,就職を機に引越しをすることにしました。就職する会社は,オフィスがい くつかの町にあって、日によって出勤するオフィスが違います。そこでAさんは,どこのオフィスに 行くにも時間の短い町に住もうと考えました。そこであなたは、Aさんを助けるため、住むのに一番便利な町を探すことになりました。 町には0から始まる番号が振られており、町と町の間には道がありま

2016-03-15 22:49:16 320

原创 hdu 1051 Wooden Sticks

问题描述There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some time,

2016-03-15 21:25:43 214

空空如也

空空如也

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

TA关注的人

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