-
Notifications
You must be signed in to change notification settings - Fork 0
/
1026.py
39 lines (31 loc) · 792 Bytes
/
1026.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def binary(n, mlen):
bina = bin(n)
bina = bina[2:len(bina)]
mbina = bin(mlen)
mbina = mbina[2:len(mbina)]
ret = ""
for nIndex in range(len(mbina) - len(bina)):
ret += "0"
return ret + bina
while True:
try:
x, y = raw_input().split(' ')
mlen = 0
if int(x) > int(y):
mlen = int(x)
else:
mlen = int(y)
x = binary(int(x), mlen)
y = binary(int(y), mlen)
r = ""
for nIndex in range(len(x)):
if x[nIndex] == y[nIndex]:
if x[nIndex] == '1':
r += '0'
else:
r += x[nIndex]
else:
r += '1'
print int(r, 2)
except EOFError:
break