标签:
1 #include<cstdio> 2 #include<iostream> 3 #include<cmath> 4 using namespace std; 5 int fen(int n) 6 { 7 int i,a; 8 for(i=0;n!=0;i++) 9 { 10 a=n%2; 11 if(a!=0) 12 { 13 return i; 14 } 15 else 16 n=n/2; 17 } 18 } 19 int main() 20 { 21 int n,i; 22 while(cin>>n) 23 { 24 if(n==0) 25 break; 26 else 27 cout<<pow(2,fen(n))<<endl; 28 29 } 30 }
标签:
原文地址:http://www.cnblogs.com/a1225234/p/4539257.html