Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {int N;
- cin>>N;
- int x=1;
- while(x<=N){
- if(x*2>N)
- {cout<<2*(N-x)+1;
- break;}
- else
- x=x*2;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement