#include <iostream> #include <algorithm> using namespace std; int lowbit(int x) { return x & -x; // ① x & (~x + 1) -> 得到的最后一位-x = ~x + 1 } int main() { int x = 8; cout << lowbit(x) << endl; return 0; }