【HDOJ】1196 Lowest Bit

水题,原理是计算机组成原理中的负数的补码的求码。利用按位与可解。

#include <iostream>

using namespace std;

int main() {

    int n;
    while (1) {
        cin >> n;
        if (n == 0)
            break;
        cout <<(n&(-n))<<endl;
    }

    return 0;
}

 

posted on 2014-02-28 22:00  Bombe  阅读(113)  评论(0编辑  收藏  举报

导航