Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # време за плуване = метри * времето за 1 метър
- # време забавяне = пъти забавяне[floor(метри / 15)] * 12.5
- # общо време = плуване + забавянето
- # проверка дали е подобрил рекорда
- import math
- record = float(input())
- distance = float(input())
- time_per_meter = float(input())
- swim_time = distance * time_per_meter
- delay_time = math.floor(distance / 15) * 12.5
- total_time = swim_time + delay_time
- # подобрява ако total_time < record
- if total_time < record:
- print(f'Yes, he succeeded! The new world record is {total_time:.2f} seconds.')
- else: #ако не е подобрен -> total_time >= record
- need_seconds = total_time - record
- print(f'No, he failed! He was {need_seconds:.2f} seconds slower.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement