From c1008fe39217be7f91f0ea23483e747bfbc5743e Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Mon, 16 Dec 2019 21:13:07 +0700 Subject: The good, the bad and the ugly --- codechef/binadd.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 codechef/binadd.py (limited to 'codechef/binadd.py') 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) -- cgit 1.4.1