You are viewing a single comment's thread. Return to all comments →
C#:
public static string counterGame(long n) { int count = 0; int i = 1; long iPower2 = 0; while(n != 1) { iPower2 = (long)Math.Pow(2,i); if(iPower2 == n) { n = n / 2; count++; i = 0; } else if( iPower2 > n ) { n= n - ( iPower2 / 2); count++; i = 0; } i++; } return (count%2==0) ? "Richard":"Louise"; }
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#: