Created
June 25, 2014 09:07
-
-
Save d2207197/de86fa5613df6e7a8d7f to your computer and use it in GitHub Desktop.
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
def split_balls(total, splits): | |
print total, splits | |
if splits == 1: | |
yield (total,) | |
else: | |
for i in range(1, total): | |
for subs in split_balls(total -i, splits -1): | |
yield (i, ) + subs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment