project Euler第六题
来源:互联网 发布:胡一天淘宝内衣模特 编辑:程序博客网 时间:2024/04/29 09:37
题目:
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.
算法:
#!usr/bin/env python#coding=utf-8a = 100*(100+1)*(200+1)/6b = (1+100)*50b = b**2print b-a
结果:
25164150
这个题没啥说的,就是两个数学公式
- project Euler第六题
- 【Project Euler】6 第六题
- project euler第一题
- Project Euler第二题
- project Euler第三题
- project Euler第四题
- project Euler第五题
- project Euler第七题
- project Euler第八题
- project Euler第十题
- project Euler第九题
- 【Project Euler】1 第一题
- 【Project Euler】2 第二题
- 【Project Euler】3 第三题
- 【Project Euler】4 第四题
- 【Project Euler】5 第五题
- 【Project Euler】7 第七题
- 【Project Euler】8 第八题
- 开发人员一定要加入收藏夹的网站
- Linq中使用ToString或Split等方法的方法
- 职场人际关系法则
- 在Oracle导出的时候避免EXP-00091错误
- Linux Socket
- project Euler第六题
- 使用JavaScript在网页上动态显示时钟
- CSS渐变之CSS3 gradient在Firefox3.6下的使用
- ARM 异常中断处理
- Emacs中文FAQ
- 面试题-整数连接问题
- Ubuntu11.10系列之四—NFS的安装与配置
- Hadoop学习资料
- zip,unzip 命令