
搜索 - BFS
是Elie呀
人生苦短,莫忘初衷;凡事相信,凡事期待。认真做事,认真做人!翁恺老师寄语:“其实学习终归是一件痛苦的事情,所以呢面对学习你还是得要认真,用功,努力地去学习。享受的是什么?是学习之后获得的那种成就,快乐是从成就中来的。”
展开
-
六度空间
“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示。图1 六度空间示意图“六度空间”理论虽然得到广泛的认同,并且正在得到越来越多的应用。但是数十年来,试图验证这个理论始终是许多社会学家努力追求的目标。原创 2017-11-29 22:58:21 · 758 阅读 · 0 评论 -
(简单双向BFS)poj1915 Knight Moves
题目链接:poj1915 Knight Moves比起单向要省时得多。#include <iostream>#include <cstdio>#include <cmath>#include <queue>#include <cstring>using namespace std;const int maxn=310...原创 2019-02-20 12:34:02 · 175 阅读 · 0 评论 -
[kuangbin带你飞]专题一 简单搜索
A POJ1321 棋盘问题 B POJ2251 Dungeon MasterC POJ3278 Catch That CowD POJ3279 FiletileE POJ1426 Find The MultipleF POJ3126 Prime PathG POJ3087 Shuffle'm UpH POJ3414 PotsI FZU2150 Fire Game...原创 2018-12-03 11:46:23 · 122 阅读 · 0 评论 -
(BFS)UVA11624 Fire!
传送门:UVA11624 Fire! 注意:可能存在多个火源。#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>#include<cmath>#include<queue>using namespace std;...原创 2018-12-01 21:32:49 · 192 阅读 · 0 评论 -
(双向bfs)hdu1401 Solitaire
传送门:hdu1401 Solitaire第一个双向bfs题目,先粘个大佬的代码学习学习:代码:#include<bits/stdc++.h>#define N 100005#define P pair<int,int>using namespace std;typedef long long ll;const int M=1e9+7;const ...原创 2018-08-18 20:33:18 · 448 阅读 · 0 评论 -
(简单bfs)百练4116:拯救行动
传送门:百练4116:拯救行动题解:因为骑士杀死守卫会耗费时间,所以要用优先队列来维护步数。收获:学会了无参构造方法的使用。代码1:注意用无参构造方法的话,就不能再构造结构体类型的变量啦,例如,Maze tmp;这样的就不可以。#include<iostream>#include<cstdio>#include<queue>#includ...原创 2018-08-18 19:49:47 · 722 阅读 · 2 评论 -
(BFS+打印路径)poj3414 Pots
poj3414 PotsDescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i...原创 2018-05-22 21:37:13 · 159 阅读 · 0 评论 -
(三维BFS)Dungeon Master
传送门: Dungeon Master DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minut...原创 2018-05-14 20:38:18 · 210 阅读 · 0 评论 -
(bfs或者dfs)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-04-11 21:03:15 · 210 阅读 · 0 评论 -
(bfs)Meteor Shower
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 way to a sa...原创 2018-04-15 11:30:33 · 207 阅读 · 0 评论 -
(bfs+路径回溯)POJ3984 迷宫问题
Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。Input一个5 ...原创 2018-03-16 21:25:21 · 315 阅读 · 0 评论 -
2141数据结构实验之图论一:基于邻接矩阵的广度优先搜索遍历
数据结构实验之图论一:基于邻接矩阵的广度优先搜索遍历 Problem Description 给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历)Input 输入第一行为整数n(0< n <100),表示数据的组数。 对于每组数据,第一行是三个整数k,m,t(0<k<100,0<m<(原创 2017-08-14 16:53:10 · 452 阅读 · 0 评论 -
数据结构实验之图论二:基于邻接表的广度优先搜索遍历
数据结构实验之图论二:基于邻接表的广度优先搜索遍历 Problem Description 给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历) Input 输入第一行为整数n(0< n <100),表示数据的组数。 对于每组数据,第一行是三个整数k,m,t(0<k<100,0<m<(原创 2017-08-15 17:37:40 · 360 阅读 · 0 评论 -
2139图结构练习——BFS——从起始点到目标点的最短步数
图结构练习——BFS——从起始点到目标点的最短步数 Problem Description在古老的魔兽传说中,有两个军团,一个叫天灾,一个叫近卫。在他们所在的地域,有n个隘口,编号为1..n,某些隘口之间是有通道连接的。其中近卫军团在1号隘口,天灾军团在n号隘口。某一天,天灾军团的领袖巫妖王决定派兵攻打近卫军团,天灾军团的部队如此庞大,甚至可以填江过河。但是巫妖王不想付出不必要的代价,他想知道在不原创 2017-08-16 17:51:23 · 296 阅读 · 0 评论 -
(bfs)POJ3278 Catch That Cow
Catch That CowProblem Description 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原创 2017-08-17 11:08:28 · 274 阅读 · 0 评论 -
(BFS)社交网络图中结点的“重要性”计算
7-2社交网络图中结点的“重要性”计算(30分)在社交网络中,个人或单位(结点)之间通过某些关系(边)联系起来。他们受到这些关系的影响,这种影响可以理解为网络中相互连接的结点之间蔓延的一种相互作用,可以增强也可以减弱。而结点根据其所处的位置不同,其在网络中体现的重要性也不尽相同。“紧密度中心性”是用来衡量一个结点到达其它结点的“快慢”的指标,即一个有较高中心性的结点比有较低中心性的结点...原创 2017-12-02 21:48:03 · 1014 阅读 · 0 评论