fork download
  1. def compose(leng, summ, res):
  2. if leng == 0:
  3. print(res)
  4. return
  5. for i in range(summ + 1):
  6. compose(leng - 1, summ -i, res + str(i) + " ")
  7.  
  8. compose(3, 2, "")# your code goes here
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
0 0 0 
0 0 1 
0 0 2 
0 1 0 
0 1 1 
0 2 0 
1 0 0 
1 0 1 
1 1 0 
2 0 0