本题来自 Project Euler 第16题:https://projecteuler.net/problem=16

'''
Project Euler 16: Power digit sum
2**15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2**1000? Answer: 1366
''' print(sum(int(i) for i in str(2**1000)))

送分题又来了。一行代码搞定!思路:先计算出 2**1000,转为字符串,取出每个字符,转为数值,求和。搞定。

Python练习题 044:Project Euler 016:乘方结果各个数值之和的更多相关文章

  1. Python练习题 028:求3*3矩阵对角线数字之和

    [Python练习题 028] 求一个3*3矩阵对角线元素之和 ----------------------------------------------------- 这题解倒是解出来了,但总觉得 ...

  2. Python练习题 032:Project Euler 004:最大的回文积

    本题来自 Project Euler 第4题:https://projecteuler.net/problem=4 # Project Euler: Problem 4: Largest palind ...

  3. Python练习题 029:Project Euler 001:3和5的倍数

    开始做 Project Euler 的练习题.网站上总共有565题,真是个大题库啊! # Project Euler, Problem 1: Multiples of 3 and 5 # If we ...

  4. Python练习题 046:Project Euler 019:每月1日是星期天

    本题来自 Project Euler 第19题:https://projecteuler.net/problem=19 ''' How many Sundays fell on the first o ...

  5. Python练习题 039:Project Euler 011:网格中4个数字的最大乘积

    本题来自 Project Euler 第11题:https://projecteuler.net/problem=11 # Project Euler: Problem 10: Largest pro ...

  6. Python练习题 034:Project Euler 006:和平方与平方和之差

    本题来自 Project Euler 第6题:https://projecteuler.net/problem=6 # Project Euler: Problem 6: Sum square dif ...

  7. Python练习题 033:Project Euler 005:最小公倍数

    本题来自 Project Euler 第5题:https://projecteuler.net/problem=5 # Project Euler: Problem 5: Smallest multi ...

  8. Python练习题 049:Project Euler 022:姓名分值

    本题来自 Project Euler 第22题:https://projecteuler.net/problem=22 ''' Project Euler: Problem 22: Names sco ...

  9. Python练习题 048:Project Euler 021:10000以内所有亲和数之和

    本题来自 Project Euler 第21题:https://projecteuler.net/problem=21 ''' Project Euler: Problem 21: Amicable ...

随机推荐

  1. ZERO:新手应该如何学习SEO优化

    http://www.wocaoseo.com/thread-325-1-1.html 有一个10000小时理论,说是在各行各业,想成为大师级的人物就要付出10000小时的努力,在SEO这边也是如此. ...

  2. vue 在模板template中变量和字符串拼接

    例子:  :post-action="'/api/v1/reportPage/'+this.selectedPagerId+'/saveimg/'"

  3. composer安装依赖包时,php内存分配不足

    Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in pha ...

  4. Apache Pulsar 2.6.1 版本正式发布:2.6.0 功能增强版,新增 OAuth2 支持

    在 Apache Pulsar 2.6.0 版本发布后的 2 个月,2020 年 8 月 21 日,Apache Pulsar 2.6.1 版本正式发布! Apache Pulsar 2.6.1 修复 ...

  5. Android开发之使一打开activity等界面Edittext获取焦点,弹出软键盘java代码实现

    // 获取编辑框焦点 editText.setFocusable(true); //打开软键盘 IInputMethodManager imm = (InputMethodManager)getSys ...

  6. label 的autosize属性

    label 的autosize属性,显示不全的问题.

  7. oeasy教您玩转linux010108到底哪个which

    到底哪个which 回忆上次内容 我们上次讲了查找命令位置whereis 我想找到whereis的位置怎么办?

  8. HDU - 3499 -(Dijkstra变形+枚举边)

    Recently, Shua Shua had a big quarrel with his GF. He is so upset that he decides to take a trip to ...

  9. 详细分析链表中的递归性质(Java 实现)

    目录 链表中的递归性质 前言 LeetCode 上关于链表的一道问题 203 号题目 移除链表中的元素 递归的基本概念与示例 链表天然的递归性 小结 链表中的递归性质 前言 在前面的 链表的数据结构的 ...

  10. 1dialog 表单最基本的封装

    <!-- --> <template> <el-dialog :visible.sync="defaultConfigDialogAdd.dialogVisib ...