UVa784 Maze Exploration】的更多相关文章

// 题意:输入一个迷宫,从*开始遍历,把可达点标记为字符# 注意迷宫边界不规则,要用strlen判断. #include<cstdio> #include<cstring> #include<iostream> #include<string> #include<algorithm> using namespace std; + ; char maze[maxn][maxn]; , , -, }; , -, , }; int R; void d…
  Maze Exploration  A maze of rectangular rooms is represented on a two dimensional grid as illustrated in figure 1a. Each point of the grid is represented by a character. The points of room walls are marked by the same character which can be any pri…
染色问题,其实就是看看图上某一点能扩散多少. 用DFS解决,因为BFS不是很熟 =-=...以后要多练. 提交后32ms,优化了一下,在递归前进行判定,优化到22ms,不是优化的很好... 代码: #include <cstdio> #include <cstdlib> #include <cstring> char maze[31][81]; void dfs(int x, int y) { maze[x][y] = '#'; if (maze[x - 1][y] =…
#include <stdio.h> #include <string.h> char maze[50][100]; void search(int i,int j) { if(maze[i][j]!='*' && maze[i][j]!='_' && maze[i][j]!=' ') return; maze[i][j]='#'; search(i-1,j-1); search(i-1,j); search(i-1,j+1); search(i,j…
这道题看上去非常麻烦,什么迷宫啊.门之类的,事实上挺简单的,就是让把与 * 连通的都置为 # 包含 * , 直接dfs就能够了,只是我wa了好多次...最后居然是多读了一个换行.忘了加getchar()了,gets()函数 会把缓冲区里面的换行给读进去的...应该把换行去掉,血的教训啊.. . 代码: #include<stdio.h> #include<string.h> #include<stdlib.h> int dx[4]={-1,0,0,1}; int dy[…
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics 10300 - Ecological Premium 458 - The Decoder 494 - Kindergarten Counting Game 414 - Machined Surfaces 490 - Rotating Sentences 445 - Marvelous Mazes…
无向图 Introduction 图是由边连接的点的集合,有着广泛的应用空间. 一些图的术语,点,边,路径,环(圈),连通分量(子图). 简单路径不重复经过点,简单环不含有重复点和边,简单图不含自环和平行边. 树是一幅无环连通图.互不相连的树组成的集合称为森林.连通图的生成树是它的一幅子图,它含有图中的所有顶点且是一棵树.图的生成树森林是它的所有连通子图的生成树的集合.当且仅当一幅含有 V 个结点的图 G 满足下列 5 个条件之一时,它是一棵树: G 有 V-1 条边且不含有环 G 有 V-1…
Sept. 10, 2015 Study again the back tracking algorithm using recursive solution, rat in maze, a classical problem. Made a few of mistakes through the practice, one is how to use two dimension array, another one is that "not all return path returns va…
Treasure Exploration Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 6558   Accepted: 2644 Description Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored…
http://www.lightoj.com/volume_showproblem.php?problem=1027 You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors. If you choose the ith door, it ca…