SHARE
TWEET

Untitled

a guest Oct 21st, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n, N, m, mx = 1, t;
  6.  
  7. int main()
  8. {
  9.     cin >> n;
  10.     N = n;
  11.     while (mx <= N) mx<<=1;
  12.     while (n != N || !t){
  13.         m = max(m, n);
  14.         n<<=1;
  15.         if (mx & n) n |= 1;
  16.         n %= mx;
  17.         t++;
  18.     }
  19.     cout << m;
  20.     return 0;
  21. }
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
 
Top