1 #include <cstdio> 2 #include <cstdlib> 3 #include <windows.h> 4 #define MaxChild 10 5 typedef char ElemType; 6 typedef struct BiTNode 7 { 8 ElemType data; //节点的数据域 9 struct BiTNode *lchild,*rchild; //左右指针 10 }*BiTree;11 12 void visit(ElemType c,int level) //访问二叉树节点,输出... Read More
这题网上都是用DFS做的,我也不知道怎么用BFS做的。。。有个注意点,就是一步也走不动的时候,输出1Problem DescriptionThere 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 move on red tiles, he can Read More
花3小时打上的注释,分享给大家。。 1 #include 2 #include 3 const int MAXR = 20; 4 const int MAXC = 310; 5 const int MAXN = MAXR * MAXC + MAXC; 6 const int INF = MAXR * 10; 7 8 int n, m; 9 int L[MAXN], R[MAXN], U[MAXN], D[MAXN]; 10 int C[MAXN], O[MAXN], S[MAXN], H[MAXR]; 11 int nodeNumber; 12 13 void ini... Read More