码迷,mamicode.com
首页 > 编程语言 > 详细

欧拉计划(python) problem 16

时间:2015-01-27 13:22:36      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

Power digit sum

Problem 16

215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.

What is the sum of the digits of the number 21000?


Answer:
1366
Completed on Tue, 27 Jan 2015, 04:14

k=1000
temp=1;
for i in range(1,k+1):
    temp*=2
temp=str(temp)
result=0
for i in range(0,len(temp)):
    result+=int(temp[i])
print(result)


time : <1s

欧拉计划(python) problem 16

标签:

原文地址:http://blog.csdn.net/zhangzhengyi03539/article/details/43193233

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!