#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin >> n && n != 0)
{
if(n == 1)
{
cout << 1 << "\n";
continue;
}
int p = log2(n);
int r = pow(2, p);
r = n - r;
cout << 2 * r << "\n";
}
return 0;
}
using namespace std;
int main()
{
int n;
while(cin >> n && n != 0)
{
if(n == 1)
{
cout << 1 << "\n";
continue;
}
int p = log2(n);
int r = pow(2, p);
r = n - r;
cout << 2 * r << "\n";
}
return 0;
}
Comments
Post a Comment