Created
October 31, 2011 00:59
-
-
Save dnene/1326668 to your computer and use it in GitHub Desktop.
Generate weight combinations for four pieces totalling 40 pounds (int vals)
This file contains 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
wts = tuple((w1,w2,w3,n-(w1+w2+w3)) for w1 in range(1,n) for w2 in range(w1,n - w1) for w3 in range(w2, n-w1-w2) if n-(w1+w2+w3) -w3 >= 0) | |
print len(wts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment