repl.it
@jjallan/

ExoticLargeMammoth

Python 2.7

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
from itertools import*
g=lambda x,c,n=0:x and g(x-[v for v in c if v<=x][0],c,n+1)or n
f=lambda c:len(c)<3or 1-any(any(any(x==sum(p)for p in combinations(c*i,i))for i in range(g(x,c)))for x in range(c[0]*2))

for test in ((4,3,1),(25,10,5,1),(25,10,6,1),(3,2,1),(30,17,8,1),(12,8,3,1),(13,8,2,1)):
	print test
	print f(test)