Programming/Project Euler (39) 썸네일형 리스트형 [C/C++] Project Euler #14 Longest Collatz Sequence(Dynamic Programming) Problem Description:This problem involves finding the starting number below one million that produces the longest sequence when generating a Collatz sequence.The Collatz sequence is defined by the following rules:1. For a given integer n :• If n is even, divide it by 2 ( n = n / 2 ).• If n is odd, multiply it by 3 and add 1 ( n = 3n + 1 ).2. The sequence ends when n = 1 .For example, start.. [C/C++] Project Euler #13 Large Sum(modular operation) Project Euler problem #13, titled Large Sum, is described as follows:• You are given one hundred 50-digit numbers.• Your task is to compute the sum of these 100 numbers.• Then, you must output only the first ten digits of the resulting sum.In other words, the main requirement is: “Find the first ten digits of the sum of the given one-hundred 50-digit numbers.” This problem seems to be better sol.. [C/C++] Project Euler #12 Highly Divisible Triangular Number The problem is to find the first triangular number that has over 500 divisors. A triangular number is defined as the sum of natural numbers up to n , calculated using the formula \( T_n = \frac{n(n+1)}{2} \) . The task involves calculating triangular numbers and determining their divisors until one with more than 500 divisors is found. This code was written by me.//---------------------------.. Project Euler #11 : Largest product in a grid(Brute Force) This problem is actually hard to find efficient algorithms. Difficulty rating is 5%.I tried to solve it using the greed algorithm, but the greed algorithm doesn't always give the best results, but it's hard to expect a speedup because of the sorting time.Because sorting 400 data itself is basically more asymptotic than it is to compute all the products sequentially. I thought there was nothing .. 515. Project Euler #515 : Dissonant Numbers Original Problem : Let d(p,n,0) be the multiplicative inverse of n modulo prime p, defined as n × d(p,n,0) = 1 mod p. Let for k ≥ 1.Let for all primes a ≤ p = 0 ) { int64_t r = t; t = -t*rec[count]+s; s = r; } t = (t>0)?t:p+t; return t; } Nevertheless all optimization algorithms are applied to my second algorithm, It's hard to solve this problem. I guessed consuming time is 10,000 minutes which .. 508. Project Euler #508 : integers in base i-1 This problem's solvers are under 100. This is very hard problem, so I can't describe detail solving method in this blog. This problem is. Consider the Gaussian integer i-1. A base i-1 representation of a Gaussian integer a+bi is a finite sequence of digits dn-1dn-2...d1d0 such that:a+bi = dn-1(i-1)n-1 + dn-2(i-1)n-2 + ... + d1(i-1) + d0Each dk is in {0,1}There are no leading zeroes, i.e. dn-1 ≠ .. 510. Project Euler #510 : Tangent circles. This is a recent problem, so not now, difficulty rating is not determined. I think difficulty rating is about 50%. At my middle school hood, math teacher said that geometry problem can be solved if you draw lines properly. This problem is sam. This picture is that added lines and triangles on original problem image. Make repairs to the line L in circle A, make repairs to the line L in circle B, .. 10. Project Euler #10 : Sum of primes Difficulty rating is 5%. The task is to calculate all prime numbers below 2 million.The solution is straightforward: use the Sieve of Eratosthenes to find primes below 2 million.There are several algorithms to check if a number is prime, such as Miller-Rabin and AKS. However, for this problem, I believe the Sieve of Eratosthenes is the best approach. #include #include int main(){ int primes[.. 9, Project Euler #9 : Special Pythagorean triplet Difficulty rating is 5%. A Pythagorean triplet is a set of three natural numbers, a Current my project euler status. Solving problems ordered is sometimes very boring. So I am solving recent problems as possible. Solving 3-digit problems is not easy to me. The maximum difficulty level is 70% currently. Generally, solving greater than 50% is comsume 2 or 3 days. Sometimes, I gave up. Almost problems I made my own solutions. But 2 or 3 problems, I cannot find solution. For example problem #78. My best solution i.. 이전 1 2 3 4 다음