Problem 16
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)
Problem 16的更多相关文章
- (Problem 16)Power digit sum
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of th ...
- (Problem 17)Number letter counts
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + ...
- LeetCode All in One 题目讲解汇总(持续更新中...)
终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 477 Total Hamming Distance ...
- Common Bugs in C Programming
There are some Common Bugs in C Programming. Most of the contents are directly from or modified from ...
- You Can Do Research Too
You Can Do Research Too I was recently discussing gatekeeping and the process of getting started in ...
- Win32_Battery class
wmi的Win32_Battery类实现 其中EstimatedChargeRemaining属性返回剩余电量的百分比,EstimatedRunTime属性返回剩余时间(分钟) 其他属性参考http: ...
- COMBINATORIAL TESTING
COMBINATORIAL TESTING -Test note of “Essential Software Test Design” 2015-09-06 Content 16.1 Coverag ...
- CodeForce:16C-Monitor
传送门:http://codeforces.com/problemset/problem/16/C Monitor time limit per test0.5 second memory limit ...
- F题
Problem F Codeforces 16E 这道题是一道数位Dp将鱼的死活列为0两种状态然后找DP关系 •题意:有n(n<=18)条鱼,接下来的n-1天,每天会有一对鱼(a,b)相遇,每天 ...
随机推荐
- linux下oracle11G DG搭建(二):环绕主库搭建操作
linux下oracle11G DG搭建(二):环绕主库搭建操作 环境 名称 主库 备库 主机名 bjsrv shsrv 软件版本号 RedHat Enterprise5.5.Oracle 11g 1 ...
- CodeForces 653 A. Bear and Three Balls——(IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2))
传送门 A. Bear and Three Balls time limit per test 2 seconds memory limit per test 256 megabytes input ...
- zoj--3870--Team Formation(位运算好题)
Team Formation Time Limit: 3000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- z-index 、层叠上下文、层叠级别、z-index失效
一.z-index z-index默认处于非激活状态,只有定位元素(即position:relative/absolute/fixed时)才会被激活. z-index与层叠上下文关联. 当z-inde ...
- npm搭建React项目
转自:http://blog.csdn.net/u012859720/article/details/70597119 要想使用npm,首先安装Node.js 一.安装全局包 $ npm instal ...
- SQL连接其它服务器操作
Exec sp_droplinkedsrvlogin ZYB,Null --删除映射(录与链接服务器上远程登录之间的映射) Exec sp_dropserver ZYB --删除远程服务器链接 EXE ...
- Spring Boot (1) 构建第一个Spring Boot工程
Spring boot简介 spring boot是spring官方推出的一个全新框架,其设计目的是用来简化新spring应用的初始搭建以及开发过程. Spring boot特点 1.化繁为简,简化配 ...
- Redis学习笔记(五)- 数据类型之set类型
Redis 的set是string类型的无序集合.set元素最大可以包含(2的32次方-1)个元素.set的是通过hash table实现的,所以添加,删除,查找的复杂度都是O(1).hash tab ...
- Mysql Workbench 执行sql语句删除数据时提示error code 1175
error code 1175是因为有安全模式限制 执行命令SET SQL_SAFE_UPDATES = 0;之后可以进行操作
- mysqlslap对mysql进行压力测试
mysqlslap是从5.1.4版开始的一个MySQL官方提供的压力测试工具.通过模拟多个并发客户端访问MySQL来执行压力测试,并且能很好的对比多个存储引擎在相同环境下的并发压力性能差别. mysq ...