Advertisement
Spocoman

02. Bike Race

Dec 22nd, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. junior = int(input())
  2. senior = int(input())
  3. trace = input()
  4. jun_sum = 0
  5. sen_sum = 0
  6.  
  7. if trace == 'trail':
  8.     jun_sum = 5.5
  9.     sen_sum = 7
  10. elif trace == 'cross-country':
  11.     jun_sum = 8
  12.     sen_sum = 9.5
  13. elif trace == 'downhill':
  14.     jun_sum = 12.25
  15.     sen_sum = 13.75
  16. elif trace == 'road':
  17.     jun_sum = 20
  18.     sen_sum = 21.5
  19.  
  20. total = junior * jun_sum + senior * sen_sum
  21. if trace == 'cross-country' and (junior + senior) >= 50:
  22.     print(f'{(total * 0.75 * 0.95):.2f}')
  23. else:
  24.     print(f'{(total * 0.95 ):.2f}')
  25.  
  26.  
  27.  
  28. Фундаменталс решение:
  29.  
  30. junior = int(input())
  31. senior = int(input())
  32. trace = input()
  33.  
  34. junior_price = {'trail': 5.5, 'cross-country': 8, 'downhill': 12.25, 'road': 20}
  35. senior_price = {'trail': 7, 'cross-country': 9.5, 'downhill': 13.75, 'road': 21.5}
  36.  
  37. total = junior * junior_price[trace] + senior * senior_price[trace]
  38.  
  39. if trace == 'cross-country' and (junior + senior) >= 50:
  40.     total *= 0.75
  41.  
  42. print(f'{(total * 0.95 ):.2f}')
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement