Quantcast
Channel: YGC » c++
Browsing all 18 articles
Browse latest View live

Problem 67

Problem 67: Using an efficient algorithm find the maximal sum in the triangle? By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top...

View Article



R & C++ integration

这题目太标题党了,最近啃了半部《C++ Primer Plus》,除了书中习题,就没其它写过C++程序,下午读了Rcpp的文档,把mlass包里kMeans算法的核心部分用c++重新写了。 C++果然给力,速度提高不是一点两点。 > require(mlass) > data(iris) > x=iris[,-5] > res = benchmark(kMeans(x, 3,...

View Article

project euler -- problem 52

It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x,...

View Article

project euler -- problem 51

By replacing the 1st digit of *3, it turns out that six of the nine possible values: 13, 23, 43, 53, 73, and 83, are all prime. By replacing the 3rd and 4th digits of 56**3 with the same digit, this...

View Article

project euler--problem 53

There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345 In combinatorics, we use the notation, 5C3 = 10. In general, nCr =...

View Article


project euler -- problem 54

In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way: High Card: Highest value card. One Pair: Two cards of the same value. Two Pairs: Two...

View Article

project euler -- problem 55

If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindromes so quickly. For example, 349 + 943 = 1292, 1292 + 2921 = 4213 4213 + 3124 = 7337 That is, 349...

View Article

project euler -- problem 64

All square roots are periodic when written as continued fractions and can be written in the form: \( \sqrt{N}= a0 + \frac{1}{a1+\frac{1}{a2+\frac{1}{a3+...}}}\) For example, let us consider √23 \(...

View Article


project euler -- problem59

Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) = 42, and...

View Article


project euler - problem 60

The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are...

View Article

project euler-problem 63

The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power. How many n-digit positive integers exist which are also an nth power? 这道题必须要先计算n为多大时,...

View Article

project euler -- problem 69

Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are...

View Article

project euler -- problem 70

Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2, 4,...

View Article


project euler -- problem 71

Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending...

View Article

project euler -- problem 72

Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending...

View Article


project euler -- problem 73

Consider the fraction, n/d, where n and d are positive integers. If n ≤ d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending...

View Article

project euler -- problem 74

The number 145 is well known for the property that the sum of the factorial of its digits is equal to 145: 1! + 4! + 5! = 1 + 24 + 120 = 145 Perhaps less well known is 169, in that it produces the...

View Article


project euler -- problem 75

It turns out that 12 cm is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples. 12 cm: (3,4,5) 24 cm:...

View Article
Browsing all 18 articles
Browse latest View live




Latest Images