搜索
leo_10
这个作者很懒,什么都没留下…
展开
-
判断迷宫有多少路径 (dfs)
#include<stdlib.h> #include<stdio.h> int map[6][6];//地图 int temp[6][6];//标记 int N,M,T,sx,sy,fx,fy;//行,列,障碍数目,起始位置,结束位置 int sum=0;//路线的个数 int dx[4]={0,1,0,-1};//移动的四个方向 int dy[4]={...原创 2018-06-08 22:44:28 · 1334 阅读 · 0 评论 -
HDU1372 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 che...转载 2018-03-20 22:32:07 · 123 阅读 · 0 评论 -
codeforces-D- Labyrinth
题目链接 大意:给一个图,向右和向左走的次数是有限的,但是向上和向下可以无限走,问能经过图中哪些点。 题解:最开始写了一个简单的bfs,没过,然后学长给了一个样例(下面会写到),确实普通的bfs有些情况会漏掉。后来改为每一次push的时候,先判断上下的点,并添加到队头,然后判断左右的点,并添加到队尾。(并不知道为什么这样写) #include<cstdio> #include&...原创 2018-10-18 18:02:35 · 160 阅读 · 0 评论