Created
December 9, 2017 11:56
-
-
Save dbulgakov/8f152e9d99e01600f49a9c8dbd70b3b2 to your computer and use it in GitHub Desktop.
Revisions
-
dbulgakov created this gist
Dec 9, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import itertools hh = list(itertools.product([0, 1], repeat=9)) a = "101101101" b = "001011001" def f(s1, s2): assert len(s1) == len(s2) return sum(i != j for i, j in zip(s1, s2)) def hi(): counter = 0 for h in hh: tmp = ''.join(str(x) for x in h) if f(a, tmp) + f(b, tmp) == 8: counter += 1 print(counter) hi()