about summary refs log tree commit diff
path: root/codechef/binadd.py
diff options
context:
space:
mode:
Diffstat (limited to 'codechef/binadd.py')
-rwxr-xr-xcodechef/binadd.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/codechef/binadd.py b/codechef/binadd.py
new file mode 100755
index 0000000..3ab0bab
--- /dev/null
+++ b/codechef/binadd.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+for t in range(int(input())):
+    e, p = input(), input()
+    a, b = int(e, 2), int(p, 2)
+    count = 0
+    while b:
+        a, b = a^b, (a&b)<<1
+        count += 1
+    print(count)