POJ 1979】的更多相关文章

POJ 1979 Red and Black (红与黑) Time Limit: 1000MS    Memory Limit: 30000K Description 题目描述 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…
http://poj.org/problem?id=1979 #include <cstdio> #include <cstring> using namespace std; const int maxn = 21; bool vis[maxn][maxn]; char maz[maxn][maxn]; int n,m; const int dx[4] = {1,-1,0,0}; const int dy[4] = {0,0,1,-1}; int ans; bool in(int…
  fengyun@fengyun-server:~/learn/acm/poj$ cat 1979.cpp #include<cstdio> #include<iostream> #include<string> #include<algorithm> #include<iterator> #include<sstream>//istringstream #include<cstring> #include<que…
1.链接地址: http://bailian.openjudge.cn/practice/1979 http://poj.org/problem?id=1979 2.题目: 总时间限制: 1000ms 内存限制: 65536kB 描述 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.…
题目链接:http://poj.org/problem?id=1979 思路分析:使用DFS解决,与迷宫问题相似:迷宫由于搜索方向只往左或右一个方向,往上或下一个方向,不会出现重复搜索: 在该问题中往四个方向搜索,会重复搜索,所以使用vis表来标记访问过的点,避免重复搜索. 代码如下: #include <iostream> using namespace std; ; int vis[MAX_N][MAX_N]; char map[MAX_N][MAX_N]; int red_count,…
题目链接:http://poj.org/problem?id=1979 #include<cstring> #include<iostream> using namespace std; ,h=,sum=; ][]; void DFS(int p,int q) { &&p<h&&q>=&&q<n) { sum++; aa[p][q]='#'; } else return ; DFS(p-,q); DFS(p+,q);…
题目地址: http://poj.org/problem?id=1979  或者  https://vjudge.net/problem/OpenJ_Bailian-2816 Red and Black Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 46793   Accepted: 25201 Description There is a rectangular room, covered with square ti…
传送门: poj:http://poj.org/problem?id=1979 zoj:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1165 题目大意: 给你初始坐标,标记为'#'的格子不能走,求你能走的所有格子的个数(能走的为'.',初始坐标用'@'表示) 思路: 一看直接DFS就好了嘛.... 好几天没刷题了,回到家来水一发先~ #include<cstdio> #include<cstring> con…
地址 http://poj.org/problem?id=1979 Description 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't mo…
#include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cstring> using namespace std; #define MAXN 21 struct node { int x; int y; }; int n,m,g[MAXN][MAXN]; bool vis[MAXN][MAXN]; ]={,-,,}; ]={,,,-}; in…