ECOO '13 R1 P1 - Take a Number
Source Code
#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;
}