Advertisement
Spocoman

Bike Race

Sep 15th, 2023
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int junior, senior;
  7.     cin >> junior >> senior;
  8.     cin.ignore();
  9.  
  10.     string trace;
  11.     cin >> trace;
  12.  
  13.     double junSum = 0, senSum = 0;
  14.  
  15.     if (trace == "trail"){
  16.         junSum = 5.50;
  17.         senSum = 7;
  18.     }
  19.     else if (trace == "cross-country") {
  20.         junSum = 8;
  21.         senSum = 9.50;
  22.     }
  23.     else if (trace == "downhill") {
  24.         junSum = 12.25;
  25.         senSum = 13.75;
  26.     }
  27.     else if (trace == "road") {
  28.         junSum = 20;
  29.         senSum = 21.5;
  30.     }
  31.  
  32.     double sum = junior * junSum + senior * senSum;
  33.  
  34.     if (trace == "cross-country" && junior + senior >= 50) {
  35.         sum *= 0.75;
  36.     }
  37.    
  38.     printf("%.2f\n",sum * 0.95);
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement