Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int seaCount, mountCount;
- cin >> seaCount >> mountCount;
- string input;
- int profit = 0;
- while (true) {
- cin >> input;
- if (input == "Stop") {
- break;
- }
- else if (input == "sea" && seaCount > 0) {
- profit += 680;
- seaCount--;
- }
- else if (input == "mountain" && mountCount > 0) {
- profit += 499;
- mountCount--;
- }
- if (seaCount + mountCount == 0) {
- cout << "Good job! Everything is sold.\n";
- break;
- }
- }
- cout << "Profit: " << profit << " leva.\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement