LeetCode Weekly Contest 171
問題文
省略
省略
C++に変換後のコードはこちら
#define main dummy_main
{}
#undef main
class Solution {
public:
int minFlips(int a, int b, int c) {
int x, y, z;
int res = 0;
rep(i,31){
x = (a>>i) & 1;
y = (b>>i) & 1;
z = (c>>i) & 1;
if(z==(x|y)) continue;
if(z==1) res++;
if(z==0) res += x + y;
}
return res;
}
};
Current time: 2024年04月19日10時48分20秒
Last modified: 2020年01月25日23時05分00秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る
Logged in as: unknown user (not login)