fork(2) download
  1. from functools import lru_cache
  2.  
  3. @lru_cache()
  4. def yoba(s, n):
  5. if n == 1:
  6. return 0 <= s < 10
  7. return sum(yoba(s - i, n - 1) for i in range(10))
  8.  
  9. print(yoba(1, 9))
Success #stdin #stdout 0.05s 10368KB
stdin
Standard input is empty
stdout
9