原创 http://projecteuler.net/problem=13 [Answer:5537376230]
#include <cstdio> using namespace std; int main() { double sum = 0.0;
原创 http://projecteuler.net/problem=15 [Answer:137846528820]
#include <iostream> using namespace std; int main() { __int64 routes = 1; int n = 40; int m = 1; while
原创 http://projecteuler.net/problem=9 [Answer:31875000]
// a*a + b*b = c*c // a = x*x - y*y // x > y // b = 2*x*y // c = x*x + y*y // 1000 = a+b+c = 2*x*(x+y) // x*(x+y)=
原创 http://projecteuler.net/problem=1
#include <iostream> using namespace std; int SumOfArithmeticSequence(int nEqualDiff, int nTopLimit) { int nCount
原创 http://projecteuler.net/problem=7 [Answer:104743]
#include <iostream>#include <vector>using namespace std;const size_t N = 10001;int main(){ vector<int> prime(N);
原创 http://projecteuler.net/problem=4
#include <iostream> #include <algorithm> using namespace std; int GeneratePalindromicNumber(int nFirstHalf) { int
原创 http://projecteuler.net/problem=2
#include <iostream> using namespace std; int main() { int a = 1; int b = 2; int c = a + b; int nSum
原创 http://projecteuler.net/problem=16 [Answer:1366]
#include <iostream> #include <vector> #include <numeric> using namespace
原创 http://projecteuler.net/problem=20 [Answer:648]
#include <iostream> #include <vector> #include <numeric> using namespace std; int main() { vector<int> numbers;
原创 http://projecteuler.net/problem=5 [Answer:232792560]
#include <iostream>using namespace std;int GCD( int m, int n ) // greatest common divisor{ if ( m < n ) {
原创 http://projecteuler.net/problem=3
#include <iostream> using namespace std; int main() { __int64 nNumber = 600851475143LL; __int64 nResult = 0;
原创 http://projecteuler.net/problem=6 [Answer:25164150]
#include <iostream>using namespace std;int sum_of_squares( int n ){ return n * (n + 1) * (n + n + 1) / 6;}int square
原创 http://projecteuler.net/problem=8 [Answer:40824]
#include <iostream> #include <string> using namespace std; int main() { string str, tmp; while ( cin >> tmp )
原创 http://projecteuler.net/problem=12 [Answer:76576500]
// triangle(n) = n * (n + 1) / 2 // factor((p1^a1)*(p2^a2)*(pm^am))=(a1+
原创 http://projecteuler.net/problem=17 [Answer:21124]
#include <iostream> using namespace std; int main() { int letters = 0; for ( int n = 1; n <= 1000; ++n ) {