SHARE
TWEET

Untitled

a guest Jun 20th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (n == 1) {
  2.             return "Richard";
  3.         }
  4.  
  5.         boolean chanceLouise = true;
  6.         while (n > 1) {
  7.             if (Long.bitCount(n) > 1) {
  8.                 double i = 1;
  9.                 int count = 0;
  10.                 while (i < n) {
  11.                     i = Math.pow(2, count);
  12.                     if (i > n)
  13.                         break;
  14.                     count++;
  15.                 }
  16.                 count--;
  17.                 double nextNum = (long) Math.pow(2, count);
  18.                 n = (long) (n - nextNum);
  19.             } else
  20.                 {
  21.                     n = n / 2;
  22.                 }
  23.            
  24.                 if(n == 1)
  25.                     break;
  26.  
  27.             chanceLouise = !chanceLouise;
  28.         }
  29.  
  30.  
  31.         if (chanceLouise)
  32.             return "Louise";
  33.         else
  34.             return "Richard";
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top