摘要: 求周长,一开不知道怎么求,最后钻到POJ讨论区内,看到一种方法,就是‘X"周围全换成0,最后只要求0的个数就好了嗯,这种方法真好,反正我们想起来,膜拜啊!这题过了从网上搜了下发现可以用BFS做,想想也是,本身用那一种都行View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<math.h> 4 #include<string.h> 5 #include<ctype.h> 6 7 int map[25][25],f[25][25],visit[25][25], 阅读全文
posted @ 2012-06-04 23:25 zhongya 阅读(158) 评论(0) 推荐(0)
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<math.h> 5 #include<ctype.h> 6 7 int len; 8 long n,num; 9 char s[15]; 10 void DFS(int t,long ans)11 {12 int i; 13 if(t == len)14 { 15 if(ans == n) 16 num++; 17 return ; 18 }... 阅读全文
posted @ 2012-06-04 23:19 zhongya 阅读(221) 评论(0) 推荐(0)
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<math.h> 4 #include<string.h> 5 #include<ctype.h> 6 7 char map[101][101]; 8 int visit[101][101],m,n; 9 int dx[] = {0,1,-1, 0,1, 1,-1,-1}; 10 int dy[] = {1,0, 0,-1,1,-1,-1, 1};11 12 void DFS(int x,int y)13 {14 阅读全文
posted @ 2012-06-04 23:17 zhongya 阅读(174) 评论(0) 推荐(0)