Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int voucherAmount, ticketPurchased = 0, otherPurchased = 0;
- cin >> voucherAmount;
- cin.ignore();
- string command;
- while (true) {
- getline(cin, command);
- if (command == "End") {
- break;
- }
- voucherAmount -= command[0] + (command.length() > 8 ? command[1] : 0);
- if (voucherAmount < 0) {
- break;
- }
- command.length() > 8 ? ticketPurchased++ : otherPurchased++;
- }
- cout << ticketPurchased << endl << otherPurchased << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement