集训第一场 B题dfs简单题 做完这题就撤,回来再继续做吧= = 水手加油~ 1 #include 2 #include 3 4 int Count; 5 int to[4][2] = {{-1,0},{1,0},{0,1},{0,-1}}; 6 int row,col; 7 char room[....
分类:
其他好文 时间:
2014-07-19 21:04:34
阅读次数:
172
集训第一场,A题dfs简单题之前看过dfs,没实现过,第一次实现出来O(∩_∩)O~水手加油~ 1 #include 2 #include 3 using namespace std; 4 int row,col; 5 char oil[1000][1000]; 6 int to[8][2]={{-...
分类:
其他好文 时间:
2014-07-19 20:26:21
阅读次数:
190
Validate Binary Search TreeRecover Binary Search TreeSymmetric TreeSame TreeMaximum Depth of Binary TreeConstruct Binary Tree from Preorder and Inorde...
分类:
其他好文 时间:
2014-07-19 20:17:42
阅读次数:
268
Problem Description
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He ...
分类:
其他好文 时间:
2014-07-18 22:25:05
阅读次数:
246
poj 2488 A Knight's Journey(dfs+字典序路径输出)...
分类:
其他好文 时间:
2014-07-18 22:09:34
阅读次数:
244
A typical DFS usage, no big deal:class Solution {public: int dfs(TreeNode *p, int pval) { if( !p->left && !p->right ) { ...
分类:
其他好文 时间:
2014-07-17 09:55:25
阅读次数:
171
本题有几个坑注意一下就ok了。1、碰到传送门一定传送;2、地图两边都是传送门时不可行;3、起点S不一定是(0,0,0) //在这点wa了好几发 T_T处理好这几点后就是一个裸的bfs。(也有大牛写的dfs,个人感觉bfs比较好)#include #include #include using ...
分类:
其他好文 时间:
2014-07-16 15:31:15
阅读次数:
210
这一题用了DFS对每一种方法进行尝试,直到有一种成功的就possible;#include #include "string.h"using namespace std;int diff;int card[26][4]; //用于记录不同卡片的上、右、下、左、方向的数字int ca...
分类:
其他好文 时间:
2014-07-16 15:21:44
阅读次数:
201
题目:poj2446
题意:给出一个m*n的矩阵,其中有的地方有坑,然后用1*2的纸片去覆盖图,纸片不能重复,能够把出了坑的地方其他全部覆盖的话输出YES,否则NO
分析:有一道二分图经典题目,当然难点还是建图,一直没有思路,早上来忽然想到可以用(i-1)*m+j 吧矩阵中每个点转化为一个数,然后相邻连接起来建图,匈牙利,但是不知道为什么不对?求大神解释、还是理解不够深。
...
分类:
其他好文 时间:
2014-07-16 14:44:47
阅读次数:
230