题解 | #两个整数二进制位不同个数#
两个整数二进制位不同个数
https://www.nowcoder.com/practice/16e48900851646c0b2c6cdef9d7ea051
#include <stdio.h> int main() { int a = 0; int b = 0; int c = 0; scanf("%d %d",&a,&b); c = a ^ b; int count = 0; while(c) { count++; c = c & (c - 1); } printf("%d\n",count); return 0; }