1 #include"iostream" 2 using namespace std; 3 4 int CountDifferentBit(int m,int n) 5 { 6 int cnt=0,diff=m^n; 7 while(diff) 8 { 9 cnt++;10 diff=(diff-1)&diff;11 }12 return cnt;13 }14 15 int main()16 {17 int m,n;18 while(cin>>m>>n)19 {20 cout<<
本文共 382 字,大约阅读时间需要 1 分钟。
1 #include"iostream" 2 using namespace std; 3 4 int CountDifferentBit(int m,int n) 5 { 6 int cnt=0,diff=m^n; 7 while(diff) 8 { 9 cnt++;10 diff=(diff-1)&diff;11 }12 return cnt;13 }14 15 int main()16 {17 int m,n;18 while(cin>>m>>n)19 {20 cout<<
转载于:https://www.cnblogs.com/acm-jing/p/10402873.html