Problem 16
2024-10-01 06:03:06
Problem 16
pow(2, 15) = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
2的15次方等于32768,而这些数字(3+2+7+6+8)的和为26
What is the sum of the digits of the number pow(2, 1000)?
2的1000次方的位数之和为多少?
import math power = math.pow(2, 1000)
sum_of_digits = 0
with open('power_of_two.txt', 'w') as f:
print('%d' % power, file=f)
with open('power_of_two.txt') as f:
for line in f:
for c in line:
try:
sum_of_digits += int(c)
except:
pass print(sum_of_digits)
最新文章
- 解决某些Android Permission denied
- [转]C#基础回顾:Asp.net 缓存
- BZOJ 1010 玩具装箱toy(四边形不等式优化DP)(HNOI 2008)
- Java中static的用法
- Winfrom 开发系统导航菜单
- JS对象与json字符串格式
- iOS开发获取缓存文件的大小并清除缓存
- 浅析CDN存在的必要性
- JavaScript—var lef const区别
- Python的布尔值与空值
- Python面向对象——多态
- 逆袭之旅.DAY08东软实训.多态~
- Spring Boot 中使用 Jedis 及 Lettuce的对比
- Terminal Service 终端链接
- tcp端口检测
- Android 布局之LinearLayout 子控件weight权重的作用详析
- redis知识树
- 51nod1464(trie + dfs)
- RunKit &; NPM
- <;转>;C++位运算详解