C# 代码
public class Solution {
public int MinFlips(int a, int b, int c) {
int n = 31;
int result = 0;
while (n-- > 0){
int x = a & 1;
int y = b & 1;
int z = c & 1;
if ((x | y) != z){
// z == 1表示x, y都为0, 将任意翻转为1即可
if (z == 1) result += 1;
else{
// z == 0表示x, y中有1, 将1翻转为0即可
if (x == 1) result++;
if (y == 1) result++;
}
}
a >>= 1;
b >>= 1;
c >>= 1;
}
return result;
}
}