2012年3月25日

poj 1979 Red and Black

摘要: // 题意: 给定一矩形棋盘,上面仅有黑棋和红棋,要求只能在黑棋上移动,// 规定移动方向是上下左右. 给定一起点,求从起点可到达的所有黑棋的个数(包括起点)#include<iostream>#include <string.h>using namespace std;const int MAXN=25;int g[MAXN][MAXN],vis[MAXN][MAXN];int mv[4][2]={{0,1},{0,-1},{1,0},{-1,0}};int cnt;void dfs(int x,int y){ if(!g[x][y]||vis[x][y]) retu 阅读全文

posted @ 2012-03-25 21:03 sysu_mjc 阅读(119) 评论(0) 推荐(0) 编辑

导航