Nyoj 353 3D dungeon [BFS]

Source: Internet
Author: User

Question: give you a high-L-long R-wide c image. Every coordinate can be regarded as a square. You can go up, down, left, right, and front once, move a square in either direction, but cannot move it to a square marked.

Q: Can I start from S to E? If yes, please output the minimum number of moves.

Policy: simple deep search.

Note: because it is the minimum number of moves, you must select the minimum number from all that can be reached.

Code:

# include # include # include # include using namespace STD; # define INF 0x3f3f3fchar map [35] [35] [35]; int ans, L, R, C; const int dirx [6] = {1,-1, 0, 0, 0, 0}; const int diry [6] = {0, 0, 1,-1, 0, 0}; const int dirz [6] = {0, 0, 0, 0, 1,-1}; struct node {int x, y, z; int step ;}; node St, en; queue q; char s [10000]; bool vis [35] [35] [35]; int limit (node s) {return (S. x = 0 & S. y> = 0 & S. Y = 0 & S. z


Nyoj 353 3D dungeon [BFS]

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.