hdu 1196 Lowest Bit

#include

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;
}

你可能感兴趣的:(HDU,水题,HDU)