Skip to content

Instantly share code, notes, and snippets.

@dbulgakov
Created December 9, 2017 11:56
Show Gist options
  • Select an option

  • Save dbulgakov/8f152e9d99e01600f49a9c8dbd70b3b2 to your computer and use it in GitHub Desktop.

Select an option

Save dbulgakov/8f152e9d99e01600f49a9c8dbd70b3b2 to your computer and use it in GitHub Desktop.

Revisions

  1. dbulgakov created this gist Dec 9, 2017.
    27 changes: 27 additions & 0 deletions t8.py
    Original 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()