Product-sum numbers A natural number, N, that can be written as the sum and product of a given set of at least two natural numbers, {a1, a2, … , ak} is called a product-sum number: N = a1 + a2 + … + ak = a1 × a2 × … × ak. For example, 6 = 1 + 2 + 3 =…
题意:三角形数序列的第n项由公式tn = 1/2n(n+1)给出:因此前十个三角形数是: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, - 将一个单词的每个字母分别转化为其在字母表中的顺序并相加,我们可以计算出一个单词的值.求在words.txt中有多少个三角形单词? euler042.c /************************************************************************* > File Name: eu…
题意:斐波那契数列中的每一项都是前两项的和.由1和2开始生成的斐波那契数列前10项为:1, 2, 3, 5, 8, 13, 21, 34, 55, 89, -考虑该斐波那契数列中不超过四百万的项,求其中为偶数的项之和. /************************************************************************* > File Name: euler002.c > Author: WArobot > Blog: http://www.…
题目 思路: 将问题转化成最小费用流 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define y1 y11 #define fi first #define se second #define pi acos(-1.0) #define LL long long //#define mp mak…
题意:计算出以下一百个50位数的和的前十位数字. /************************************************************************* > File Name: euler013.c > Author: WArobot > Blog: http://www.cnblogs.com/WArobot/ > Created Time: 2017年06月25日 星期日 10时55分56秒 *******************…
本题来自 Project Euler 第21题:https://projecteuler.net/problem=21 ''' Project Euler: Problem 21: Amicable numbers Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b…
本题来自 Project Euler 第6题:https://projecteuler.net/problem=6 # Project Euler: Problem 6: Sum square difference # The sum of the squares of the first ten natural numbers is, # 1**2 + 2**2 + ... + 10**2 = 385 # The square of the sum of the first ten natur…
In Problem 42 we dealt with triangular problems, in Problem 44 of Project Euler we deal with pentagonal number, I can only wonder if we have to deal with septagonal numbers in Problem 46. Anyway the problem reads Pentagonal numbers are generated by t…
本题来自 Project Euler 第4题:https://projecteuler.net/problem=4 # Project Euler: Problem 4: Largest palindrome product # A palindromic number reads the same both ways. # The largest palindrome made from the product # of two 2-digit numbers is 9009 = 91 × 9…
题目要求是: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319…