Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int junior, senior;
- cin >> junior >> senior;
- cin.ignore();
- string trace;
- cin >> trace;
- double junSum = 0, senSum = 0;
- if (trace == "trail"){
- junSum = 5.50;
- senSum = 7;
- }
- else if (trace == "cross-country") {
- junSum = 8;
- senSum = 9.50;
- }
- else if (trace == "downhill") {
- junSum = 12.25;
- senSum = 13.75;
- }
- else if (trace == "road") {
- junSum = 20;
- senSum = 21.5;
- }
- double sum = junior * junSum + senior * senSum;
- if (trace == "cross-country" && junior + senior >= 50) {
- sum *= 0.75;
- }
- printf("%.2f\n",sum * 0.95);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement