Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- target_height = int(input())
- starting_height = target_height - 30
- success_counter = 0
- current_fails_counter = 0
- total_fails_counter = 0
- max_height = 0
- jumps = 0
- for set_height in range(starting_height, target_height + 1, 5):
- current_jump_height = int(input())
- while True:
- jumps += 1
- if current_jump_height > set_height:
- current_fails_counter = 0
- max_height = current_jump_height
- break
- else:
- current_fails_counter += 1
- max_height = set_height
- if current_fails_counter == 3:
- break
- else:
- current_jump_height = int(input())
- continue
- if current_fails_counter == 3:
- break
- if target_height < max_height:
- print(f"Tihomir succeeded, he jumped over {target_height}cm after {jumps} jumps.")
- else:
- print(f"Tihomir failed at {max_height}cm after {jumps} jumps.")
Add Comment
Please, Sign In to add comment