E. Twisted Circuit
time limit per test
2 seconds
memory limit per test
64 megabytes
Input
The input consists of four lines, each line containing a single digit 0 or 1.
Output
Output a single digit, 0 or 1.
Example
Input
0
1
1
0
Output
0
a = bool(input())
b = bool(input())
c = bool(input())
d = bool(input())
x1 = a or b
x2 = c != d
x3 = b and c
x4 = a or d
y1 = x1 and x2
y2 = x3 != x4
print(int(y1 or y2))
为什么答案是这个:
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int a,b,c,d;
cin >> a >> b >> c >> d;
cout << ((((a^b)&(c|d))^((b&c)|(a^d)))) << endl;
return 0;
}