diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-12-16 21:13:07 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-12-16 21:13:07 +0700 |
commit | c1008fe39217be7f91f0ea23483e747bfbc5743e (patch) | |
tree | c4f921bccd9e8d66e3aadd9a01ede3300d73afa6 /codechef/binadd.py | |
parent | 8a9d6282fcb863c67d6623f5c883ef703721cccd (diff) | |
download | cp-c1008fe39217be7f91f0ea23483e747bfbc5743e.tar.gz |
The good, the bad and the ugly
Diffstat (limited to 'codechef/binadd.py')
-rwxr-xr-x | codechef/binadd.py | 9 |
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) |