#include<stdio.h> int main() { int i,n,a[10000],sum,j; while(~scanf("%d",&n)&&n) { sum=1; for(i=0;;i++) { a[i]=n%2; n=n/2; if(a[i]) break; } for(j=1;j<=i;j++) sum=sum*2; printf("%d\n",sum); } return 0; }
时间: 2024-10-25 03:59:30
#include<stdio.h> int main() { int i,n,a[10000],sum,j; while(~scanf("%d",&n)&&n) { sum=1; for(i=0;;i++) { a[i]=n%2; n=n/2; if(a[i]) break; } for(j=1;j<=i;j++) sum=sum*2; printf("%d\n",sum); } return 0; }