Advertisement
iskhakovt

play

Sep 14th, 2015
107
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 <vector>
  3.  
  4. using namespace std;
  5.  
  6. #define opp(x) (1 - x)
  7.  
  8. int main() {
  9.     vector<int> score(2, 0);
  10.     int service = 1, count = -1, curr;
  11.    
  12.     std::string str;
  13.     do {
  14.         cin >> str;
  15.        
  16.         if (str == "service") {
  17.             ++count;
  18.             if (count % 5 == 0) {
  19.                 service = opp(service);
  20.             }
  21.             curr = service;
  22.         } else if (str == "net" || str == "out") {
  23.             ++score[opp(curr)];
  24.         } else if (str == "goal") {
  25.             ++score[curr];
  26.         } else if (str == "return") {
  27.             curr = opp(curr);
  28.         }
  29.     } while (str != "eom");
  30.    
  31.     cout << score[0] << ' ' << score[1] << '\n';
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement