用python解决 Project Euler 问题 记录
由于比较擅长java 对python相对陌生,就用python来解答
源码:
sumAll =0
for index in range(1,1000):
if index%3==0 or index%5 ==0:
sumAll += index
print(sumAll)
用python解决 Project Euler 问题 记录
由于比较擅长java 对python相对陌生,就用python来解答
源码:
sumAll =0
for index in range(1,1000):
if index%3==0 or index%5 ==0:
sumAll += index
print(sumAll)
The sequence of triangle numbers is generated by adding the natural numbers. So the 7thtriangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...Let us list the factors of the first seven triangle numbers:1: 13: 1,36: 1,2,3,610: 1,2
Usingnames.txt(right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a na
Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner.How many routes are there through a 2020 grid?1#include<iostream>2usingnamespacestd;34#definenum415longlongPascalTriangle[num][num];67voidCalcPascalTriangle()8{9PascalTriangle[0][
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.A numbernis called deficient if the sum of its proper divisors is less tha
Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:2122 23 242520 78 91019 6 12 1118 54 3121716 15 1413It can be verified that the sum of the numbers on the diagonals is 101.What is the sum of the numbers on the diagonals in a 1001 by 100
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:012 021 102 120 201 210
You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September,April, June and November.All the rest have thirty-one,Saving February alone,Which has twenty-eight, rain or shine.And on leap years, twenty-nine.A leap year
The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?1#include<iostream>2usingnamespacestd;34longlongGetFirstFactor(longlongnum)5{6longlongroot=sqrt((longdouble)num);7for(longlongi=2;i<root;i++)8{9if(num%i==0)10{11returni;12}13}1415retu
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M