https://projecteuler.net/problem=6
2016-02-23 21:29
645 查看
Sum square difference
Problem 6
The sum of the squares of the first ten natural numbers is,12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
太简单了,都没有解释的必要result = 0
sumrange = sum(range(1,101))
for i in range(1,101):
result += i * (sumrange - i)
print(result)
相关文章推荐
- 深入探讨 Java 类加载器 https://www.ibm.com/developerworks/cn/java/j-lo-classloader/
- 网络编程3---常用服务器编程模型
- 《python核心编程》读书笔记--第16章 网络编程
- https://projecteuler.net/problem=5
- B树、B-树、B+树、B*树的特点 及其性能比较 http://blog.csdn.net/panghuizl/article/details/6921631
- TCP协议与UDP协议
- 常见网络协议端口号整理
- 基于layer mobile手机端弹出框,询问框(PC端推荐layer和artDialog:http://download.csdn.net/download/cometwo/9437895)
- TCP TimeWait状态详解(比较全)
- Python3网络相关
- 基础网络学习记录
- C++之路进阶——网络流(晨跑)
- 网络编程_InetAddress_InetSocketAddress_URL_爬虫原理JAVA185-186
- 浏览器被劫持到http://hao.169x.cn/?v=108的解决办法
- HttpURLConnection请求
- Caffe下python环境的编译和使用draw_net.py绘制lenet网络结构图
- IOS使用AFNetworking进行网络通信
- 使用HttpClient进行远程接口测试
- 网络编程2---select poll epoll
- Apache2.4之httpd.conf配置详解