随笔分类 -  DFS专题

摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1241今天第一次做DFS的题,虽然这道题目也可以用BFS,不过我还是觉得DFS简单,所以就用DFS,把八个方向的点都置为0,只剩一个2,所以只要查找2的个数即可。。代码:#include <stdio.h>#include <string.h>#include <stdlib.h>int hash[120][120];void DFS(int x,int y){ if(x<0||y<0||(hash[x][y]!=2)) return ; if(hash[x][ 阅读全文
posted @ 2011-08-02 22:29 ○o尐懶錨o 阅读(145) 评论(0) 推荐(1)