自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

青山绿水之辈 专栏

成大事者,不惟有超世之才,亦有坚忍不拔之志。

  • 博客(48)
  • 资源 (6)
  • 问答 (1)
  • 收藏
  • 关注

原创 hdu2112 HDU Today (最短路之dijkstra和spfa)

Problem Description经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在

2013-08-28 21:46:47 1085

原创 hdu2544最短路(dijkstra)

Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N输入保证至少存在1条商店到赛场的路线。Out

2013-08-28 20:36:59 989

原创 hdu1301Jungle Roads(最小生成树之prim)

Problem DescriptionThe 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 overt

2013-08-22 19:53:31 1121

原创 POJ2031Building a Space Station (最小生成树之prim)

Problem DescriptionYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complet

2013-08-22 17:26:06 974

原创 建立平衡二叉树(AVL)

创立方法:先把n个数从小到大排序,然后用了二分法建立 平衡二叉树(AVL);如果不信的话可以用先序遍历或后序遍历来验证正确性。#include#include#include#includeusing namespace std;typedef struct nn{ int w; struct nn *lchilde,*rchilde;}tree,*Tree;

2013-08-22 00:16:34 3203 1

原创 POJ1679The Unique MST (最小生成树之Prim )(有点坑人)

Problem DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning t

2013-08-21 12:19:37 1294

原创 POJ3723Conscription (最大生成树之Kruskal)

Problem DescriptionWindy has a country, and he wants to build an army to protect his country. He has picked upN girls and M boys and wants to collect them to be his soldiers. To collect a sold

2013-08-20 14:03:18 1154

原创 hdu3999The order of a Tree (二叉排序树(BST))

Problem DescriptionAs we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely:1. insert a key k to a empty tree, then the tree become a tree wi

2013-08-19 17:55:40 1796

原创 POJ2253 Frogger (最小生成树之prim)

Problem DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and

2013-08-19 11:34:47 1055

原创 POJ1258Agri-Net (最小生成树之prim)

Problem DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer

2013-08-18 18:19:49 1011

原创 poj2075Tangled in Cables (最小生成树之prim)

Problem DescriptionYou are the owner of SmallCableCo and have purchased the franchise rights for a small town. Unfortunately, you lack enough funds to start your business properly and are relying on

2013-08-18 18:15:49 1141

原创 hdu2988Dark roads (最小生成树之kruskal 算法(主要是并查集))

Problem DescriptionEconomic times these days are tough, even in Byteland. To reduce the operating costs, the government of Byteland has decided to optimize the road lighting. Till now every road was

2013-08-17 23:44:13 1357

原创 hdu3367Pseudoforest (最大生成树之kruskal 算法)

Problem DescriptionIn graph theory, a pseudoforest is an undirected graph in which every connected component has at most one cycle. The maximal pseudoforests of G are the pseudoforest subgraphs of G

2013-08-17 23:35:53 3436

原创 hdu3371Connect the Cities(prim算法优化+自写scanf 函数)

Problem DescriptionIn 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but most of them become disconnected. The government

2013-08-17 19:19:14 1317

原创 hdu1863 畅通工程(最小生成树之prim)

Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( < 1

2013-08-17 12:34:03 942

原创 hdu1875 畅通工程再续 (最小生成树之prim 算法)

Problem Description相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米

2013-08-17 12:28:07 1167

原创 hdu1879 继续畅通工程 (最小生成树之prim 算法)

Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 1

2013-08-17 10:56:02 1038

原创 hdu1162 Eddy's picture (最小生成树之prim 算法)

Problem DescriptionEddy 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 pictu

2013-08-16 23:29:35 1127

原创 hdu1102 Constructing Roads (最小生成树 prim 算法)

Problem DescriptionThere 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 connec

2013-08-16 20:30:30 943

原创 hdu1233 还是畅通工程(最小生成树 prim 算法)

Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 当N为0时,输入结束

2013-08-16 18:46:21 1065

原创 hdu1700 Points on Cycle (数学)

Problem DescriptionThere is a cycle with its center on the origin.Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between eac

2013-08-15 15:24:29 1016

原创 hdu4515小Q系列故事——世界上最遥远的距离

Problem Description  世界上最遥远的距离  不是生与死  而是我就站在你面前  你却不知道我爱你  世界上最遥远的距离  不是我就站在你面前你却不知道我爱你  而是明明知道彼此相爱  却不能在一起  世界上最遥远的距离  不是明明知道彼此相爱却不能在一起  而是相约好了私奔的时间  我穿越到了未来 你却回去了古代

2013-08-15 15:20:46 887

原创 hdu4530小Q系列故事——大笨钟

Problem Description  饱尝情感苦恼的小Q本打算隐居一段时间,但仅仅在3月25号一天没有出现,就有很多朋友想念他,所以,他今天决定再出来一次,正式和大家做个告别。    小Q近来睡眠情况很差——晚上睡不着,早上又起不来!以前总是全勤的他这个月甚至迟到了好几次,虽然主管没说什么,但是他自己清楚此事的严重性。  爱情没有了,小Q不想再失去面包,于是他决定买个闹钟,为求

2013-08-15 00:13:34 1169

原创 POJ 1686 Lazy Math Instructor (模似题+栈的运用) 各种坑

Problem DescriptionA math instructor is too lazy to grade a question in the exam papers in which students are supposed to produce a complicated formula for the question asked. Students may write cor

2013-08-14 23:05:29 1240

原创 SDUTRescue The Princess(数学问题)

题目描述    Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immediately. Yet, the

2013-08-13 21:40:52 1018

原创 SDUT2608(Alice and Bob)

题目描述    Alice and Bob like playing games very much.Today, they introduce a new game.    There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1). Then Al

2013-08-13 21:34:20 1183

原创 hdu1043Eight (经典的八数码)(康托展开+BFS)

建议先学会用康托展开:Problem DescriptionThe 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a num

2013-08-13 21:20:32 3254

原创 hdu4527小明系列故事——玩转十滴水 (BFS+DFS)

Problem Description  小明最近喜欢上了一个名为十滴水的游戏。  游戏是在一个6*6的方格内进行的,每个格子上有一滴水或者没有水滴。水滴分为四个等级1~4。初始时你有十滴水,通过把水加入格子内的水滴,会让水滴升1级。你也可以把水放到空格子内,这样会在这个格子里面产生一个1级的水滴。当水滴等级大于4时则会爆裂为四个小水滴,并向四个方向飞溅。每个飞溅的小水滴碰到其

2013-08-12 20:56:06 1710

原创 FZOJ2110 star(DFS)

Overpower often go to the playground with classmates. They play and chat on the playground. One day, there are a lot of stars in the sky. Suddenly, one of Overpower’s classmates ask him: “How many acu

2013-08-11 22:24:00 1131

原创 hdu1430魔板(BFS+康托展开)

做这题先看:http://blog.csdn.net/u010372095/article/details/9904497Problem Description在魔方风靡全球之后不久,Rubik先生发明了它的简化版——魔板。魔板由8个同样大小的方块组成,每个方块颜色均不相同,可用数字1-8分别表示。任一时刻魔板的状态可用方块的颜色序列表示:从魔板的左上角开始,按顺时针方向依次写下各方块

2013-08-11 22:06:48 4108 5

转载 康托展开

康托展开  康托展开的公式是 X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0! 其中,ai为当前未出现的元素中是排在第几个(从0开始)。  这个公式可能看着让人头大,最好举个例子来说明一下。例如,有一个数组 s = ["A", "B", "C", "D"],它的一个排列 s1 = ["D", "B", "A", "C"],现在要

2013-08-11 21:02:24 4136 3

原创 hdu1728逃离迷宫 (利用最短路径思想+优先队列(BFS))

Problem Description  给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,gloria不能走到迷宫外面去。令人头痛的是,gloria是个没什么方向感的人,因此,她在行走过程中,

2013-08-09 21:27:15 1817

原创 hdu1271整数对 (数学题)

Problem DescriptionGardon和小希玩了一个游戏,Gardon随便想了一个数A(首位不能为0),把它去掉一个数字以后得到另外一个数B,他把A和B的和N告诉了小希,让小希猜想他原来想的数字。不过为了公平起见,如果小希回答的数虽然不是A,但同样能达到那个条件(去掉其中的一个数字得到B,A和B之和是N),一样算小希胜利。而且小希如果能答出多个符合条件的数字,就可以得到额外的糖果。

2013-08-09 10:28:00 1023

原创 hdu1104Remainder (BFS)

Problem DescriptionCoco is a clever boy, who is good at mathematics. However, he is puzzled by a difficult mathematics problem. The problem is: Given three integers N, K and M, N may adds (‘+’) M, s

2013-08-08 20:13:02 1304

原创 hdu1208Pascal's Travels (DFS+记忆化搜索(DP))

Problem DescriptionAn n x n game board is populated with integers, one nonnegative integer per square. The goal is to travel along any legitimate path from the upper left corner to the lower right c

2013-08-08 11:56:19 1515

原创 hdu1978How many ways (记忆化搜索+DFS)

Problem Description这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下:1.机器人一开始在棋盘的起始点并有起始点所标有的能量。2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。3.机器人不能在原地停留。4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只有终点所标记的能量。

2013-08-08 10:19:31 1107

原创 hdu1428漫步校园( 最短路+BFS(优先队列)+记忆化搜索(DFS))

Problem DescriptionLL最近沉迷于AC不能自拔,每天寝室、机房两点一线。由于长时间坐在电脑边,缺乏运动。他决定充分利用每次从寝室到机房的时间,在校园里散散步。整个HDU校园呈方形布局,可划分为n*n个小方格,代表各个区域。例如LL居住的18号宿舍位于校园的西北角,即方格(1,1)代表的地方,而机房所在的第三实验楼处于东南端的(n,n)。因有多条路线可以选择,LL希望每次的散步

2013-08-08 00:51:43 2049

原创 hdu1142A Walk Through the Forest (最短路+BFS+DFS )

Problem DescriptionJimmy 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 n

2013-08-07 22:52:32 1091

原创 hdu3790最短路径问题(BFS+优先队列)

Problem Description给你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时输入结束。

2013-08-07 14:49:50 1199

原创 hdu1226 超级密码 (BFS,里面用了大数取余原理)

Problem DescriptionIgnatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密码锁起来了,在门旁边的墙上有一些关于密码的提示信息:密码是一个C进制的数,并且只能由给定的M个数字构成,同时密码是一个给定十进制整数N(0注意:由于宝藏的历史久远,当时的系统最多只能保存500位密码.因此如果得到的密码长度大于500也不能用来开启房门,这

2013-08-05 20:30:36 1056

代码行数统计工具

代码统计工具,在上面你可以选择一个代码文件夹,然后再进行代码统计,就可以知道你以前写过的所有代码,一共有多少行代码

2014-04-04

最短路Floyd算法

在计算有环有方向的最短路时,可以用Floyd算法计算出任意两点之间的最短路!

2014-04-04

刘汝佳的黑书

黑书对于每个编程人员来讲,都是有必要去看的,里面的很多算法都是非常的红典,从中可以学到很多我们在书本上学不到的东西!

2014-04-04

背包九讲算法

背包九讲里面讲述了九种不同的背包类型,对于想学背包的人来说,这是一个不错的选择!

2014-04-04

C++写程序时用到的库函数

C++库函数里面描术了很多函数的名字和相应的功能,在写程序时可以很方便的进行调用!

2014-04-04

汇编DOS-MASM615

汇编安装包:如果想写汇编程序时,先安装些包,然后就可以在DOS下编程

2014-04-04

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

TA关注的人

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