题解 | #两个整数二进制位不同个数#
两个整数二进制位不同个数
https://www.nowcoder.com/practice/16e48900851646c0b2c6cdef9d7ea051
int main() { int n = 0; int m = 0; int x = 0; int y = 0; int count = 0; scanf("%d %d",&n,&m); for (int i = 0; i < 32; i++) { x = n % 2; n = n / 2; y = m % 2; m = m / 2; if (x != y) { count++; } } printf("%d",count); return 0; }