自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

nucleare的博客

任何坚持梦想的人,都值得我们尊敬

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

原创 小希的迷宫 HDU - 1272 (并查集)

上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的...

2018-05-31 20:35:38 140

原创 畅通工程 HDU - 1232 (简单并查集)

某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对正整...

2018-05-30 21:58:26 144

原创 堆排序代码

#include<iostream> #include<cstdio> using namespace std; int h[10010]; int n; void swap(int x,int y)//交换下标为x和y的两个数 { int t; t=h[x]; h[x]=h[y]; h[y]=t; return; } void siftdown(int i)...

2018-05-30 20:59:23 264

原创 C - Curling 2.0 (dfs)

On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is mark...

2018-05-28 20:55:26 193

原创 给力的移动 FZU - 2287

你的弟弟给你安排了一个任务,他给了你1到N个数字的乱序排列,现在你想给你的弟弟秀一波操作,操作最少的次数把序列变成1到N的顺序排列,每次操作你可以选择序列中的一个数字并把它移动到序列的头部或尾部。 Input 包含多组测试数据。 每组测试数据的第一行为正整数N,表示排列的长度。 第二行为N个数字的乱序排列。 n≤100000 Outpu...

2018-05-28 18:42:03 277

原创 B - Children of the Candy Corn(双dfs+bfs)

The cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terrors on their que...

2018-05-24 21:10:25 139

原创 A - A Knight's Journey (poj2488)(dfs经典)

A Knight's JourneyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 27258 Accepted: 9295DescriptionBackground The knight is getting bored of seeing the same black and white squares again and a...

2018-05-23 21:37:32 200

原创 D - 棋盘问题 (dfs经典题)poj1321

在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n 当为-1...

2018-05-22 21:40:03 826

原创 Heavy Transportation POJ1797

Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his cust...

2018-05-21 20:48:14 112

原创 最短路径·三:SPFA算法(HihoCoder - 1093)(BELLMAN-FORD队列优化)

描述万圣节的晚上,小Hi和小Ho在吃过晚饭之后,来到了一个巨大的鬼屋!鬼屋中一共有N个地点,分别编号为1..N,这N个地点之间互相有一些道路连通,两个地点之间可能有多条道路连通,但是并不存在一条两端都是同一个地点的道路。不过这个鬼屋虽然很大,但是其中的道路并不算多,所以小Hi还是希望能够知道从入口到出口的最短距离是多少?提示:Super Programming Festival Algorithm...

2018-05-17 21:12:08 166

原创 最短路径问题 (图论入门+dijkstra(单源最短路))

给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。 (1<n<=1000, 0<m<10...

2018-05-16 20:25:21 225

原创 大整数乘法

#include<iostream> #include<cstdio> #include<string> using namespace std; void solve() { string s1; string s2; int ans[500]={0}; int a[250]={0}; int b[250]={0}; cin>>s1...

2018-05-14 20:29:39 94

原创 A - 白富美

又到了学长勾引学妹、学妹勾搭学长、学姐垂涎学弟、学弟攀附学姐、学姐嫉妒学妹、学妹憎恨学姐、学长抛弃学姐、学姐报复学长、学长欺瞒学弟、学弟巴结学长、学弟追求学妹、学妹拒绝学弟的季节了。 这时风流倜傥,玉树临风的黄爷,黄大爷驾临nbut,他一来贵校就以他的24K钛合金狗眼看上了n个百富美!可惜的是咱黄爷是个专一man,于是他决定从这n个白富美中挑最白的,如果2个同样白,就选择较富的那个,如果2个是还是...

2018-05-10 21:27:38 283

原创 H - Hiking Trip (bfs+priority_queue)

Hiking in the mountains is seldom an easy task for most people, as it is extremely easy to get lost during the trip. Recently Green has decided to go on a hiking trip. Unfortunately, half way through ...

2018-05-07 20:59:00 268

原创 B - 胜利大逃亡 (三维数组的bfs)

Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会. 魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Ig...

2018-05-03 20:54:45 144

原创 C - Nightmare (双bfs)

Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial ...

2018-05-03 15:05:26 188

原创 D - Prime Path

The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of sec...

2018-05-02 20:37:37 166

原创 A - A strange lift (bfs)

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 down.When you at floor i,if...

2018-05-02 17:20:01 130

空空如也

空空如也

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

TA关注的人

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