自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 最小生成树---prim算法

Prime算法:1:从任意一个顶点开始构造生成树,假设就从0号顶点吧,首先将顶点1号加入生成树中,用一个一维数组book来标记那些顶点已经加入了生成树。2:用数组dis记录生成树到各个顶点的距离。最初生成树中只有1号顶点,有直连边时,数组dis中存储的就是1号顶点到该顶点的边的权值,没有直连边的时候就是无穷大,即初始化dis数组。3:从数组dis中选出离生成树最近的顶点(假设这个顶点为j)加...

2018-07-30 13:54:13 269 2

原创 最小生成树---Kruskal算法

该算法基本思想:首先按照边的权值大小进行从下到大的排序,每次从剩下的边中选择权值较小且边的两个顶点不在同一个集合内的边(就是不会产生回路的边),加入到生成树中,直到加入了n-1条边为止。代码模板:#include <stdio.h>#include <string.h>struct edge { int u; int v; int w;};stru...

2018-07-30 13:49:23 109

原创 最短路算法总结

Floyed-Warshall算法,是属于多源最短路径算法,是来计算任意两点之间的最短路径算法。这个算法核心代码就只有五行,基本思想是:最开始只允许经过1号顶点进行,接下来只允许经过1号和2号中转......允许经过1至n号顶点中转,用一句话概括就是,从i号顶点只经过前k号顶点的最短路程。算法结束之后,dis[i][j]存的就是从i到j的最短路径。比如想知道a点到b点的最短路,只能加入中间点来缩短...

2018-07-29 21:33:45 449

原创 MPI Maelstrom

BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research advi...

2018-07-28 17:12:16 110

原创 Currency Exchange(Bellman-Ford,判断正权回路)

Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can...

2018-07-28 16:40:00 250

原创 Wormholes (Floyd 负权回路)

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 time that i...

2018-07-28 16:19:10 2564

原创 Catch That Cow

Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,0...

2018-07-27 19:08:03 119

原创 Frogger (迪杰斯拉变形)

Freddy 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 full of tourists' sun...

2018-07-26 17:41:28 213

原创 Heavy Transportation (迪杰斯拉变形)

BackgroundHugo 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-07-26 17:37:24 237

原创 最短路

在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是...

2018-07-25 12:48:02 141

原创 HDU-1874 畅通工程续

某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<200,0<M...

2018-07-25 12:46:36 91

原创 kmp算法总结

Kmp算法总结Kmp算法主要是对字符串的处理,就是一个文本串s和一个模式串p相匹配。我理解的Kmp算法的主要思路是:将模式串与文本串一一对比,如果相同,就往后加,再对比,如果不同,这时候返回的是此字符相同前后缀下一位的位置,因为,前面的字符是相同的,那么就可以省去比较相同的前缀,就从相同前后缀的下一位开始比较,此不相同的字符前的字符都已经是相同的了,这样就可以省去很多时间,举个例子,比如文...

2018-07-25 10:04:13 98

原创 HDU 1867 A + B for you again

Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of the addition between ...

2018-07-24 21:51:02 117

原创 HDU-1711 Number Sequence

Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K ...

2018-07-24 21:47:23 118

原创 HDU-2594 Simpsons’ Hidden Talents(kmp)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2594Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had.Marge: Yea...

2018-07-23 22:35:45 136

原创 Cyclic Nacklace

CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to...

2018-07-23 16:25:43 115

原创 亲和串(kmp)

人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长大了却不知道怎么去判断亲和串了,于是他只好又再一次来请教聪明且乐于助人的你来解决这个问题。亲和串的定义是这样的:给定两个字符串s1和s2,如果能通过s1循环移位,使s2包含在s1中,那么我们就说s2 是s1的亲和串。Input...

2018-07-22 11:07:45 174

原创 Oulipo (kmp)

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout s...

2018-07-22 11:02:29 196

原创 Farm Irrigation

Benny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square has a different type of ...

2018-07-21 14:24:23 213

原创 博弈总结

巴什博弈:只有一堆,一堆中n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个。最后取光者得胜。通过网上的分析可知,这不是运气的好坏,完全是凭谁先取,如果n%(m+1)==0,那么后手必胜。 威佐夫博弈:有两堆各若干的物品,两人轮流从其中一堆取至少一件物品,至多不限,或从两堆中同时取相同件物品,规定最后取完者胜利。结论,...

2018-07-20 22:27:33 90

原创 A New Stone Game (博弈)

Alice and Bob decide to play a new stone game.At the beginning of the game they pick n(1<=n<=10) piles of stones in a line. Alice and Bob move the stones in turn.At each step of the game,the pl...

2018-07-19 11:12:50 863

原创 Matches Game (尼姆博弈)

Here is a simple game. In this game, there are several piles of matches and two players. The two player play in turn. In each turn, one can choose a pile and take away arbitrary number of matches f...

2018-07-19 11:08:03 508

原创 取石子游戏 (威佐夫博弈)

有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石...

2018-07-18 21:32:13 134

原创 Goldbach's Conjecture

In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Every even number greater than 4 can bewritten as the sum of t...

2018-07-18 21:15:36 2817 2

原创 异或

1:概念异或运算符”∧”,它的规则是若参加运算的两个二进位同号,则结果为0(假);异号则为1(真)。即 0∧0=0,0∧1=1, 1^0=1,1∧1=0。运算 说明 0^0=0,0^1=1 0异或任何数,其结果=任何数 1^0=1,1^1=0 1异或任何数,其结果=任何数取反 x^x=0 任何数异或自己,等于把自己置0 2:运算与应用运算:先转化...

2018-07-18 20:44:06 60662 1

原创 Tempter of the Bone

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. He realized that the bone ...

2018-07-17 19:29:09 85

原创 Red and Black

There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can'...

2018-07-17 19:26:53 708

原创 Prime Ring Problem (dfs)

A 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.Note: the number of f...

2018-07-17 19:22:47 143

原创 A strange lift

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-07-17 19:19:10 375 1

原创 Knight Moves (bfs)

A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboa...

2018-07-17 19:13:30 133

StuMa.zip,学生信息管理系统

使用mysql数据库,基于Java的软件设计,主要包括对学生,班级,院系,成绩,课程的录入与管理,学生可以查看自己的成绩,管理员用户可以管理增加院系,增加专业,增加课程,还可以删除与修改。

2019-07-12

空空如也

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

TA关注的人

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