Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- #define read() freopen("input.txt", "r", stdin)
- #define write() freopen("output.txt", "w", stdout)
- void fastIO()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- }
- int main()
- {
- //read();
- //write();
- fastIO();
- int n,x;
- while(cin>>n && n){
- x=1;
- while(x*2<=n) x*=2;
- if(x!=n){
- n-=x;
- n*=2;
- }
- cout<<n<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement