You are viewing a single comment's thread. Return to all comments →
C++
int getExp(long i){ int ex=0; while(i > 1){ i /= 2; ex ++; } return ex; } string counterGame(long n) { int rounds = 0; while(n > 1){ int e = getExp(n); if(n == pow(2, e)) n /= 2; else n -= pow(2, e); rounds ++; }; if(rounds % 2 == 1) return "Louise"; return "Richard"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
C++