Skip to content

Commit 130e997

Browse files
authored
Merge pull request #13 from tapumar/comp
Create comp_q1.py
2 parents 40da86e + 1b12191 commit 130e997

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Uri_Online_Judge/comp_q1.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import sys
2+
3+
for linha in sys.stdin:
4+
A,B = linha.split()
5+
A = int(A)
6+
B = int(B)
7+
A = bin(A)[2:].zfill(32)
8+
B = bin(B)[2:].zfill(32)
9+
C = bin(0)[2:].zfill(32)
10+
x = 31
11+
while x >=0:
12+
if A[x] != B[x]:
13+
list_aux = list(C)
14+
list_aux[x] = '1'
15+
C = ''.join(list_aux)
16+
x = x - 1
17+
C = int(C,2)
18+
print (C)

0 commit comments

Comments
 (0)