Advertisement
bl00dt3ars

02. Bike Race

Nov 26th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. juniors = int(input())
  2. seniors = int(input())
  3. trace = input()
  4.  
  5. if trace == "trail":
  6.   juniors *= 5.5
  7.   seniors *= 7
  8. elif trace == "cross-country":
  9.   if juniors + seniors >= 50:
  10.     juniors *= 8 * 0.75
  11.     seniors *= 9.50 * 0.75
  12.   else:
  13.     juniors *= 8
  14.     seniors *= 9.50
  15. elif trace == "downhill":
  16.   juniors *= 12.25
  17.   seniors *= 13.75
  18. else:
  19.   juniors *= 20
  20.   seniors *= 21.5
  21.  
  22. total = (juniors + seniors) * 0.95
  23. total1 = int(total)
  24. total2 = total % 1
  25. if len(str(total2)) >= 5:
  26.     if str(total2)[4] == "5":
  27.         total2 += 0.001
  28. print(f"{total1 + total2:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement