Oil Deposits hdu1241 DFS

Source: Internet
Author: User
# 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 ..
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.