Advertisement
Nenogzar
Feb 12th, 2024
95
0
Never
This is comment for paste 3. Kate's Way Out
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Kate is stuck in a maze. You should help her to find her way out.
  2. On the first line, you will be given how many rows there are in the maze. On the following n lines, you will be given the maze itself. Here is a legend for the maze:
  3. • "#" - means a wall; Kate cannot go through there
  4. • " " - means empty space; Kate can go through there
  5. • "k" - the initial position of Kate; start looking for a way out from there
  6. There are two options: Kate either gets out or not:
  7. • If Kate can get out, print the following:
  8. "Kate got out in {number_of_moves} moves".
  9. Note: If there are two or more ways out, she always chooses the longest one.
  10. • Otherwise, print: "Kate cannot get out".
  11.  
  12. Input
  13. 4
  14. ######
  15. ## k#
  16. ## ###
  17. ## ###
  18.  
  19. Output:
  20. Kate got out in 5 moves
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement