Sichanov

high

Aug 14th, 2021
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. height = int(input())
  2. jump = 0
  3. jump_counter = 0
  4. is_failed = False
  5. fail = 0
  6. thirty_cm_below_target = height - 30
  7. while thirty_cm_below_target <= height:
  8.     jump = int(input())
  9.     jump_counter += 1
  10.     if jump <= thirty_cm_below_target:
  11.         fail += 1
  12.         if fail == 3:
  13.             is_failed = True
  14.             break
  15.     else:
  16.         thirty_cm_below_target += 5
  17.         fail = 0
  18.     if is_failed:
  19.         break
  20. if not is_failed:
  21.     print(f"Tihomir succeeded, he jumped over {height}cm after {jump_counter} jumps.")
  22. else:
  23.     print(f'Tihomir failed at {thirty_cm_below_target}cm after {jump_counter} jumps.')
  24.  
Advertisement
Add Comment
Please, Sign In to add comment