(HDU)1196 -- Lowest Bit(最低位)

题目链接:http://vjudge.net/problem/HDU-1196

二进制最低位可以用位运算,也可以模拟这个步骤。

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cmath>
 4 #include <algorithm>
 5 
 6 using namespace std;
 7 
 8 int main()
 9 {
10     int A,t;
11     while(scanf("%d",&A),A)
12     {
13         t=1;
14         while(A)
15         {
16             if(A%2==1)break;
17             A/=2;
18             t*=2;
19         }
20         printf("%d
",t);
21     }
22     return 0;
23 }
原文地址:https://www.cnblogs.com/ACDoge/p/6132298.html