1 #include <iostream> 2 using namespace std; 3 int GetCount(int num) 4 { 5 int m=0; 6 while(num) 7 { 8 num &=(num-1); 9 m++; 10 } 11 return m; 12 } 13 int main() 14 { 15 int a; 16 cin>>a; 17 cout<<GetCount(a)<<endl; 18 }
标签:std bsp style nbsp count return main while pos
1 #include <iostream> 2 using namespace std; 3 int GetCount(int num) 4 { 5 int m=0; 6 while(num) 7 { 8 num &=(num-1); 9 m++; 10 } 11 return m; 12 } 13 int main() 14 { 15 int a; 16 cin>>a; 17 cout<<GetCount(a)<<endl; 18 }
标签:std bsp style nbsp count return main while pos
原文地址:https://www.cnblogs.com/zaijiefangbeidawang/p/8196745.html