Demo entry 4102987

python test

   

Submitted by anonymous on Mar 20, 2016 at 02:57
Language: Python. Code size: 806 Bytes.

from itertools import *

impossible = {'13': '2', 
              '46': '5', 
              '79': '8', 
              '17': '4', 
              '28': '5', 
              '39': '6', 
              '19': '5', 
              '37': '5',
              '31': '2',
              '64': '5',
              '97': '8',
              '71': '4',
              '82': '5',
              '93': '6',
              '91': '5',
              '73': '5'}

def counts():
    iterlst = chain(*(permutations('123456789', i) for i in range(4, 10)))
    count = 0
    for i in iterlst:
        stri = ''.join(i)
        for k, v in impossible.items():
            if k in stri and v not in stri[:stri.find(k)]:
                break
        else:
            count += 1
    return count

print(counts())

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).