【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)<<"\n";
    }
    return 0;
}
posted @ 2018-05-26 13:24  gwj1139177410  阅读(102)  评论(0编辑  收藏  举报
选择