Spocoman

High Jump

Feb 23rd, 2022 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. jump_target = int(input())
  2. start_jump = jump_target - 30
  3. counter = 0
  4. fall = 0
  5.  
  6. while fall != 3 and start_jump <= jump_target:
  7.     jump = int(input())
  8.    
  9.     if jump > start_jump:
  10.         start_jump += 5
  11.         fall = 0
  12.     else:
  13.         fall += 1
  14.        
  15.     counter += 1
  16.  
  17. if start_jump <= jump_target:
  18.     print(f"Tihomir failed at {start_jump}cm after {counter} jumps.")
  19. else:
  20.     print(f"Tihomir succeeded, he jumped over {jump_target}cm after {counter} jumps.")
  21.  
Add Comment
Please, Sign In to add comment