Advertisement
Dorijanko

Yoda(750)

Aug 24th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. Yoda and Luke Skywalker are peacefully sitting on an infinite tree that I don't know the name of. The root of the tree has the ID 1, and each node has N children with IDs X*N, X*N+1, X*N+2, ..., X*N+N-1, where X is the ID of the parent. This is what the first 3 depths of a tree with N=3 look like:(image from statement)
  2. Yoda was suddenly attacked by villains and Luke wants to save him. Help Luke and tell him the distance between him and Yoda!
  3. Input: N, the ID of the node Yoda is on, the ID of the node Luke is on.
  4. Output: The distance.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement