Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. to avoid as much attention as possible when you're moving around the viking ship you've created a ingenious system
  2. to walk whereever you're supposed to walk
  3.  
  4. if you're at row N and N is an even number, you go straight to row N/2. if N is an odd number you go to row 3N+1
  5. and you continue this until you've reached your target row.
  6.  
  7. There's a limited number of rows in the ship. if your system is leading you to non-existing rows, you just have to return to your spot and return that it's not possible to reach your destination
  8.  
  9. input:
  10. a line with three whole numbers N(number of total rows), M(start row) and K(destination).
  11.  
  12. output: a whole number wich represents the number of moves you have to make to get to the destination.
  13. if there's no solution, return "-1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement