Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- desired_height = int(input()) # Желана височина в см
- open_height = desired_height - 30
- unsuccessful_jump = 0
- jumps = 0
- limit_height = open_height
- check_desired_height = False
- while True:
- current_height = int(input())
- jumps += 1
- if current_height > limit_height:
- #if current_height > desired_height:
- if limit_height == desired_height: # Задачата се решава, само ако летвата е на желаната височина и скока е по-висок
- check_desired_height = True
- break
- unsuccessful_jump = 0
- limit_height += 5
- # elif current_height > limit_height and current_height == desired_height:
- # check_desired_height = True
- # break
- else:
- unsuccessful_jump += 1
- if unsuccessful_jump > 2: break
- if check_desired_height:
- print(f"Tihomir succeeded, he jumped over {limit_height}cm after {jumps} jumps.")
- else:
- print(f"Tihomir failed at {limit_height}cm after {jumps} jumps.")
Add Comment
Please, Sign In to add comment