2012年3月29日

poj 2488 DFS

摘要: 水题,注意字典序输出 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 const int maxx=50; 6 int dir[8][2]={{-2,-1},{-2,1},{-1,-2},{-1,2},{1,-2},{1,2},{2,-1},{2,1}}; 7 int n,m,p1[maxx*maxx+2],p2[maxx*maxx+2],cnt; 8 bool visit[maxx+2][maxx+2]; 9 10 bool 阅读全文

posted @ 2012-03-29 15:20 Inpeace7 阅读(124) 评论(0) 推荐(0) 编辑

POJ 1111 DFS

摘要: DFS 水题求周长:若当前状态旁边有k个x,则总周长加4-x 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 6 const int maxx=20; 7 int dir[8][2]={{0,-1},{1,0},{0,1},{-1,0},{1,-1},{1,1},{-1,1},{-1,-1}}; 8 int cnt,n,m; 9 char c[maxx+2][maxx+2];10 bool visit[maxx+2][maxx+ 阅读全文

posted @ 2012-03-29 10:52 Inpeace7 阅读(165) 评论(0) 推荐(0) 编辑

poj 2386 DFS

摘要: DFS 水题 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 6 const int maxx=100; 7 int n,m,cnt,dir[8][2]={{0,-1},{1,-1},{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1}}; 8 char pool[maxx+2][maxx+2]; 9 bool visit[maxx+2][maxx+2];10 11 bool judge(int a,i 阅读全文

posted @ 2012-03-29 09:22 Inpeace7 阅读(109) 评论(0) 推荐(0) 编辑

导航