Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. def f(a, b, c):
  2. if a + b + c == 0:
  3. return [""]
  4. result = []
  5. if a > 0:
  6. for i in f(a - 1, b, c):
  7. result.append(i + "2")
  8. if b > 0:
  9. for i in f(a, b - 1, c):
  10. result.append(i + "1")
  11. if c > 0:
  12. for i in f(a, b, c - 1):
  13. result.append(i + "0")
  14. return result
  15.  
  16.  
  17. a, b, c = list(map(int, input().split()))
  18. print(*sorted(f(a, b, c)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement