【POJ2453】An Easy Problem

problem

solution

codes

#include<iostream>
using namespace std;
int main(){
    unsigned int n, x;
    while(cin>>n &&n){
        x = n&-n;
        cout<<(n+x+(n^(n+x))/x/4)<<"
";
    }
    return 0;
}
原文地址:https://www.cnblogs.com/gwj1314/p/9444802.html