当前位置: 代码迷 >> 综合 >> Project Euler problem 65
  详细解决方案

Project Euler problem 65

热度:15   发布时间:2024-01-13 17:25:49.0

。。水题。

直接模拟这个过程即可

arr = []
arr.append(2)
for i in range(1, 50):arr.append(1)arr.append(2 * i)arr.append(1)
up = 1
now = 99
down = arr[now]
for i in range(now - 1, -1, -1):ta = arr[i] * down + upup = downdown = ta
sum = 0
up = down
while up:sum += up % 10up /= 10
print sum



  相关解决方案