#include <iostream>
using namespace std;
int n,st,en;
int main(){
ios::sync_with_stdio(0);
int n;
cin>>n;
while(n){
int x=n,s=0;
while(x>>=1)
s++;
if(n==1<<s)
cout<<n<<endl;
else
cout<<2*(n-(1<<s))<<endl;
cin>>n;
}
}
using namespace std;
int n,st,en;
int main(){
ios::sync_with_stdio(0);
int n;
cin>>n;
while(n){
int x=n,s=0;
while(x>>=1)
s++;
if(n==1<<s)
cout<<n<<endl;
else
cout<<2*(n-(1<<s))<<endl;
cin>>n;
}
}
Comments
Post a Comment