Advertisement
desislava_topuzakova

07. World Swimming Record

Apr 26th, 2020
763
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. # време за плуване = метри * времето за 1 метър
  2. # време забавяне = пъти забавяне[floor(метри / 15)] * 12.5
  3. # общо време = плуване + забавянето
  4. # проверка дали е подобрил рекорда
  5. import math
  6. record = float(input())
  7. distance = float(input())
  8. time_per_meter = float(input())
  9.  
  10. swim_time = distance * time_per_meter
  11. delay_time = math.floor(distance / 15) * 12.5
  12. total_time = swim_time + delay_time
  13.  
  14. # подобрява ако total_time < record
  15. if total_time < record:
  16.     print(f'Yes, he succeeded! The new world record is {total_time:.2f} seconds.')
  17. else: #ако не е подобрен -> total_time >= record
  18.     need_seconds = total_time - record
  19.     print(f'No, he failed! He was {need_seconds:.2f} seconds slower.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement