AV代码 @[LG233666](/user/1159940)
```python
def dfs(x, count):
global res
if count > n:
return
if x > 10:
if count == n:
ans.append(arr[1:11])
res += 1
return
for i in range(1, 4):
arr[x] = i
dfs(x + 1, count + i)
arr[x] = 0
n = int(input())
arr = [0] * 20 # 存方案
res = 0 # 存方案数
ans = []
dfs(1, 0)
print(res)
if res!=0:
for i in range(len(ans)):
for j in range(10):
print(ans[i][j], end=" ")
print()
```
by jzr21894 @ 2024-04-07 15:48:47