Chinaunix首页 | 论坛 | 博客
  • 博客访问: 469231
  • 博文数量: 117
  • 博客积分: 3195
  • 博客等级: 中校
  • 技术积分: 1156
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-04 01:44
文章分类

全部博文(117)

文章存档

2012年(5)

2011年(5)

2010年(46)

2009年(61)

我的朋友

分类: C/C++

2010-09-09 09:51:22

#include 
#define N 102
int g[N][N];
int ans[N][N];
int mov[4][2] = {-1, 0, 0, -1, 1, 0, 0, 1};
int max;
int c, r;

int in(int x, int y)
{
	if(x<0 || x>=c || y<0 || y>=r)
		return 0;
	return 1;
}
//pre为0,标志为起始点
void dfs(int k, int pre)
{
  int i, t;
  int tx, ty, x, y;

  for(t=k; t g[y][x] && ans[y][x]+1 > ans[ty][tx]) {
          ans[ty][tx] = ans[y][x] + 1;
          if(max < ans[ty][tx])
            max = ans[ty][tx];

          dfs(ty*c+tx, 1);
        }
      }
      if(ans[y][x]>0)
        return;
    }
  }
}

int main()
{
  int i, j;
  freopen("1088.in", "r", stdin);
  scanf("%d%d", &r, &c);
  for(i=0; i
		
		
		
		                                   
阅读(1345) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~