Advertisement
Spocoman

Excursion Sale

Sep 18th, 2023
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int seaCount, mountCount;
  8.     cin >> seaCount >> mountCount;
  9.  
  10.     string input;
  11.  
  12.     int profit = 0;
  13.  
  14.     while (true) {
  15.         cin >> input;
  16.         if (input == "Stop") {
  17.             break;
  18.         }
  19.         else if (input == "sea" && seaCount > 0) {
  20.             profit += 680;
  21.             seaCount--;
  22.         }
  23.         else if (input == "mountain" && mountCount > 0) {
  24.             profit += 499;
  25.             mountCount--;
  26.         }
  27.  
  28.         if (seaCount + mountCount == 0) {
  29.             cout << "Good job! Everything is sold.\n";
  30.             break;
  31.         }
  32.     }
  33.    
  34.     cout << "Profit: " << profit << " leva.\n";
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement