Advertisement
Guest User

tudor

a guest
Mar 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {int N;
  7. cin>>N;
  8. int x=1;
  9. while(x<=N){
  10. if(x*2>N)
  11. {cout<<2*(N-x)+1;
  12. break;}
  13. else
  14. x=x*2;
  15. }
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement