Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- #define opp(x) (1 - x)
- int main() {
- vector<int> score(2, 0);
- int service = 1, count = -1, curr;
- std::string str;
- do {
- cin >> str;
- if (str == "service") {
- ++count;
- if (count % 5 == 0) {
- service = opp(service);
- }
- curr = service;
- } else if (str == "net" || str == "out") {
- ++score[opp(curr)];
- } else if (str == "goal") {
- ++score[curr];
- } else if (str == "return") {
- curr = opp(curr);
- }
- } while (str != "eom");
- cout << score[0] << ' ' << score[1] << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement