Advertisement
pacho_the_python

Untitled

Jul 13th, 2023
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. record = int(input())
  2.  
  3. jumps = 0
  4. failed_jump = 0
  5. not_success = False
  6. lath_high = record - 30
  7. successful_jump = 0
  8. good_jump = 0
  9. while lath_high <= record:
  10.     for jump in range(1, 3 + 1):
  11.         current_jump = int(input())
  12.         jumps += 1
  13.         if current_jump <= lath_high:
  14.             failed_jump += 1
  15.  
  16.         if current_jump > lath_high:
  17.             successful_jump += 1
  18.             good_jump = lath_high
  19.             failed_jump = 0
  20.             lath_high += 5
  21.             break
  22.     if failed_jump == 3:
  23.         not_success = True
  24.         break
  25.  
  26. if not_success:
  27.     print(f"Tihomir failed at {lath_high}cm after {jumps} jumps.")
  28. if good_jump >= record:
  29.     print(f"Tihomir succeeded, he jumped over {good_jump}cm after {jumps} jumps.")
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement