BFS
囧九
大学萌新
展开
-
数据结构实验之图论五:从起始点到目标点的最短步数(BFS)
数据结构实验之图论五:从起始点到目标点的最短步数(BFS)Time Limit: 1000 msMemory Limit: 65536 KiBProblem Description 在古老的魔兽传说中,有两个军团,一个叫天灾,一个叫近卫。在他们所在的地域,有n个隘口,编号为1..n,某些隘口之间是有通道连接的。其中近卫军团在1号隘口,天灾军团在n号隘口。某一天,天灾军团的领袖巫妖王决定派兵攻打近卫...原创 2018-05-21 19:49:19 · 172 阅读 · 0 评论 -
B - Dungeon Master
点击打开链接You 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 minute to move one unit no...转载 2018-05-26 20:47:22 · 143 阅读 · 0 评论 -
E - Find The Multiple
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than ...原创 2018-05-28 20:16:13 · 117 阅读 · 0 评论 -
K - 迷宫问题
定义一个二维数组: 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表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右...转载 2018-05-29 20:15:41 · 178 阅读 · 0 评论 -
N - Find a way
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki. Yifenfei’s home is at the ...原创 2018-05-31 21:04:52 · 392 阅读 · 0 评论 -
Fire Game
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start...原创 2018-07-24 15:07:15 · 152 阅读 · 0 评论 -
Fire! UVA - 11624
#include<iostream>#include<cstring>#include<queue>using namespace std;#define inf 0x3f3f3f3fint n, m;int vis[1100][1100];int vis1[1100][1100];char mmap[1100][1100];int x1, ...原创 2018-07-26 15:47:50 · 90 阅读 · 0 评论 -
非常可乐 HDU - 1495
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,101>S>...原创 2018-07-26 19:27:29 · 108 阅读 · 0 评论 -
G - Ancient Go HDU - 5546
Yu Zhou likes to play Go with Su Lu. From the historical research, we found that there are much difference on the rules between ancient go and modern go. Here is the rules for ancient go they were pl...原创 2018-08-07 15:12:09 · 270 阅读 · 0 评论