Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n, m, res;
  7. cin >> n;
  8. int i = 0;
  9. while (n >= 2)
  10. {
  11. m = 2;
  12. while (n > m)
  13. m *= 2;
  14. n -= m / 2;
  15. i++;
  16. }
  17. if (n == 1) i++;
  18. if (n == 2) i += 2;
  19. if (i % 3 == 0) res = 2;
  20. if (i % 3 == 1) res = 0;
  21. if (i % 3 == 2) res = 1;
  22. cout << res << endl;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement