Problem 48

The series, 11+22+33+...+1010=10405071317.

Find the last ten digits of the series, 11+22+33+...+10001000.

Answer:

9110846700

Completed on Thu, 23 Jul 2015, 17:26

初步思路。能够利用元对的方式计算每个数须要乘的数

def func(a):
for i in range(0,len(a)):
a[i][1]*=a[i][0]
return a a=[[i,i] for i in range(1000,0,-1)]
result=0
while len(a)>0:
result+=a.pop()[1]
a=func(a) print(result%(pow(10,10)))

更进一步,能够利用数组下标得到须要乘的数

def func(a):
for i in range(0,len(a)):
a[i]=a[i]*(1000-i)
return a a=[i for i in range(1000,0,-1)]
result=0
while len(a)>0:
result+=a.pop()
a=func(a) print(result%(pow(10,10)))

最新文章

  1. ajax请求成功后新开窗口window.open()被拦截解决方法
  2. zeppelin-0.6.0安装配置
  3. 怎么在win7的64位旗舰版上配置coocs2d-x 3.2的android环境并且打包APK
  4. Java实现---堆排序 Heap Sort
  5. java代码实现如何获取当前经纬度?(安卓的话可以用GPS取)
  6. select2取值报错,Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('hidden') does not support selection.
  7. ajax traditional
  8. 图像处理工具包ImagXpress中如何定义图像显示属性
  9. java的nio之:java的nio系列教程之FileChannel
  10. 坑爹系列:sizeof运算符
  11. JS插件-日期
  12. hdoj 1200 To and Fro
  13. strace基本操作
  14. Mac下如何使用Vim
  15. Objective-c学习笔记3
  16. List之Union(),Intersect(),Except() 即并集,交集,差集运算。
  17. bzoj 4605: 崂山白花蛇草水
  18. eclipse中git解决冲突
  19. cocos2dx中的坐标系统
  20. Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-2.xml, reason:

热门文章

  1. legend---八、php对象如何转换成js对象
  2. 智课雅思短语---五、 in contrast / on the contrary
  3. 转一篇100offer的采访~35岁程序员是一种什么状态
  4. 6.CPU调度
  5. 深入理解JavaScript定时机制
  6. sql排名函数--四个
  7. Could not create connection to database server. Attempted reconnect 3 times. Giving up.错误
  8. Unity 框架(一)
  9. main()函数的形参
  10. javaEE之-------统计站点刷新量