Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string counterGame(long n) {
- long count=0;
- while(n)
- {
- long bits=0;
- long ones=0;
- long temp=n;
- while(temp)
- {
- if(temp%2!=0)
- ones++;
- bits++;
- temp>>=1;
- }
- bits=bits-1;
- if(ones==1)
- {
- n/=2;
- }
- else
- {
- n-=(1<<bits);
- }
- count++;
- if(n==1)
- break;
- }
- if(count%2!=0)
- return "Louise";
- else
- return "Richard";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement