与第112题解法完全相同,结果是$51161058134250$。
b=[list(range(10))]
c=[[min(10-k,9) for k in range(10)]]
s=99
i=2
while i < 100:
b.append([sum(b[-1][j] for j in range(k+1)) for k in range(10)])
c.append([sum(c[-1][j] for j in range(k,10)) for k in range(10)])
s=s+sum(b[-1])+sum(c[-1])-9
i+=1
print s
|