# Include // 2367513 2010-04-21 20:22:34 accepted 1241 15 ms 340 K 992 B C ++ regret
Using namespace STD;
Char map [105] [105];
Int dir [8] [2] = {0, 1}, {0,-1}, {1, 0}, {-1, 0}, {1, 1 },{ 1,-1 },{-1, 1 },{-1,-1 }};
Int M, N; // an error occurred at the beginning.
Void DFS (int x, int y)
{
Int I;
// If (x = M | Y> = N)
// Return;
For (I = 0; I = M | Y + dir [I] [1] = N)
Continue;
If (Map [x + dir [I] [0] [Y + dir [I] [1] = '*')
Continue;
// If (Map [x + dir [I] [0] [Y + dir [I] [1] = '@')
//{
Map [x + dir [I] [0] [Y + dir [I] [1] = '*';
DFS (x + dir [I] [0], Y + dir [I] [1]);
//}
}
}
Int main ()
{
Int count;
While (CIN> m> N)
{
If (M = 0)
Break;
Int I, J;
For (I = 0; I> map [I] [J];
Count = 0;
For (I = 0; I
Using namespace STD;
Char map [105] [105];
Int dir [8] [2] = {0, 1}, {0,-1}, {1, 0}, {-1, 0}, {1, 1 },{ 1,-1 },{-1, 1 },{-1,-1 }};
Int M, N;
Void DFS (int x, int y)
{
Int I;
If (x = M | Y> = N)
Return;
For (I = 0; I = M | Y + dir [I] [1] = N)
// Continue;
// If (Map [x + dir [I] [0] [Y + dir [I] [1] = '*')
// Continue;
If (Map [x + dir [I] [0] [Y + dir [I] [1] = '@')
{
Map [x + dir [I] [0] [Y + dir [I] [1] = '*';
DFS (x + dir [I] [0], Y + dir [I] [1]);
}
}
}
Int main ()
{
Int count;
While (CIN> m> N)
{
If (M = 0)
Break;
Int I, J;
For (I = 0; I> map [I] [J];
Count = 0;
For (I = 0; I
Previous Article: prime ring problem HDU 1016 DFS
Next article: Is rescue HDU 1242 hard to understand? Who will help me ..