擅长:python、mysql、java
<pre><code>def num_pieces(num,lenght):
ot = list(range(1,lenght+1))[::-1]
all_list = []
for i in range(lenght-1):
n = random.randint(1, num-ot[i])
all_list.append(n)
num -= n
all_list.append(num)
return all_list
num_pieces(167,12)
</code></pre>