摘要: http://poj.org/problem?id=1222搜索,关灯游戏,可以用高斯消元做搜索代码: 1 #include <stdio.h> 2 #include <string.h> 3 4 int map[8][8], map1[8][8], stack[8][8]; 5 6 void change(int i, int j) 7 { 8 map1[i][j] ^= 1; 9 map1[i][j-1] ^= 1; 10 map1[i][j+1] ^= 1; 11 map1[i-1][j] ^= 1; 12 map1[i+1]... 阅读全文
posted @ 2013-03-10 16:04 Yuan1991 阅读(206) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3051搜索,简单搜索 1 #include <stdio.h> 2 3 char map[1234][88]; 4 int n, m, dir[4][2] = {1,0, 0,1, -1,0, 0,-1}; 5 6 int dfs(int x, int y) 7 { 8 int sum = 1, i, p, q; 9 for(i=0; i<4; i++)10 {11 p = x + dir[i][0];12 q = y + dir[i][1];13 if(map[p... 阅读全文
posted @ 2013-03-10 14:58 Yuan1991 阅读(123) 评论(0) 推荐(0) 编辑