Created
December 9, 2017 11:56
-
-
Save dbulgakov/8f152e9d99e01600f49a9c8dbd70b3b2 to your computer and use it in GitHub Desktop.
160
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 characters
| 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment