本文共 1369 字,大约阅读时间需要 4 分钟。
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=46522
简单DFS,题目翻译参考 http://blog.csdn.net/synapse7/article/details/14453017
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include 16 17 #define CL(arr, val) memset(arr, val, sizeof(arr))18 19 #define ll long long20 #define inf 0x7f7f7f7f21 #define lc l,m,rt<<122 #define rc m + 1,r,rt<<1|123 #define pi acos(-1.0)24 25 #define L(x) (x) << 126 #define R(x) (x) << 1 | 127 #define MID(l, r) (l + r) >> 128 #define Min(x, y) (x) < (y) ? (x) : (y)29 #define Max(x, y) (x) < (y) ? (y) : (x)30 #define E(x) (1 << (x))31 #define iabs(x) (x) < 0 ? -(x) : (x)32 #define OUT(x) printf("%I64d\n", x)33 #define lowbit(x) (x)&(-x)34 #define Read() freopen("a.txt", "r", stdin)35 #define Write() freopen("dout.txt", "w", stdout);36 #define maxn 100000000037 #define N 11038 using namespace std;39 40 char filed[N][N];41 int w,h,sum;42 int dir[4][2]={-1,0,1,0,0,1,0,-1};43 44 void dfs(int x,int y,char c)45 {46 for(int i=0;i<4;i++)47 {48 int xx=x+dir[i][0];49 int yy=y+dir[i][1];50 if(xx>=0&&xx =0&&yy
转载于:https://www.cnblogs.com/nowandforever/p/4372601.html