Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- to_reach = int(input())
- start_jump = to_reach - 30
- jump_counter = 1
- fail_jump = 0
- success_jump = 0
- failed = False
- current_jump = int(input())
- success_after_fail = False
- while True:
- if current_jump > start_jump:
- success_jump += 1
- start_jump += 5
- if success_jump == 7 and start_jump > to_reach:
- break
- current_jump = int(input())
- jump_counter += 1
- elif current_jump <= start_jump:
- while fail_jump != 3:
- if current_jump > start_jump:
- success_jump += 1
- start_jump += 5
- fail_jump = 0
- elif current_jump <= start_jump:
- success_jump = +1
- fail_jump += 1
- if fail_jump == 3:
- failed = True
- continue
- elif fail_jump != 3 and start_jump > to_reach:
- success_after_fail = True
- break
- current_jump = int(input())
- jump_counter += 1
- if success_after_fail:
- break
- print(f"Tihomir failed at {start_jump}cm after {jump_counter} jumps.")
- break
- if not failed:
- print(f"Tihomir succeeded, he jumped over {to_reach}cm after {jump_counter} jumps.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement