Solution for ECOO '13 R1 P1 - Take a Number in C++


March 15, 2020 0.039969 seconds C++
#include <iostream>

int main(){
    std::ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
    int current; std::string holder; int tcount = 0, scount = 0;
    std::cin >> current;
    
    do{
        std::cin >> holder;
        if(holder.compare("TAKE") == 0){
            tcount++;

        }else if(holder.compare("SERVE") == 0){
            scount++;

        }else if(holder.compare("CLOSE") == 0){
			current = (tcount + current) % 999;
            std::cout << tcount << " " << tcount - scount << " " << current << "\n";
            tcount = 0;
            scount = 0;

        }
        
    }while(holder.compare("EOF") != 0);
    return 0;
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.