思路:搞过树状数组就知道这题是有多简单。详情请看树状数组详解
代码:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define N 100010
#define MAX 1000010
int x;
int main() {
while(~scanf("%d",&x),x) {
printf("%d\n",x&(-x));
}
return 0;
}