Advertisement
Adnan_Sarker

uDebug Uva - 12032

May 30th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. 1. Find the maximum distance from all value
  2. 2. set k= the maximum value
  3. 2. If you can complete the process as sample on Problem, then print initial k, Otherwise print initial k+1 .
  4.  
  5. Let, the height of the rungs from the ground are 2, 8, 11, 16, 21 respectively
  6. maximum distance is 6, k=6
  7. Jumped 2 foot from the ground to the 1st rung (ground to 1). Since I jumped less than k feet, k remains 6.
  8.  
  9. Jumped 6 feet for the next rung (2 to 8). Since I jumped equal k feet, k becomes 5.
  10. Jumped 3 foot for the 3rd rung (8 to 11). So, k remains 5.
  11. Jumped 5 feet for the 4th rung (11 to 16). This k becomes 4.
  12. Jumped 5 feet for the 5th rung (16 to 21). This time i need to jump 5 but k is 4, you can’t complete the process.
  13. So, the Ans = 6+1=7
  14.  
  15. Thanks :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement