Project Euler Problem10

2015. 2. 15. 01:29프로그래밍/알고리즘

728x90
728x90

Problem10

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.

Find the sum of all the primes below two million.


나의 풀이)

정말.. 수퍼 발코딩으로 풀었다.

저번에 구현했던 isPrime 함수를 통해 소수를 찾고 2,000,000까지 반복문!

isPrime에서 돌아가는 for문과 메인에서 돌아가는 for문을 합치니... 거의 O(n^2)급이니

루프 200만번은 정말 가혹한 속도..

15분만에 결과가 나왔는데.... 여튼 답은 구했다..


외국 고수님들 풀이를 좀 읽어봐야겠다.


다른 사람의 풀이)

continue ... 






728x90
반응형

'프로그래밍 > 알고리즘' 카테고리의 다른 글

Project Euler Problem8  (0) 2015.02.28
Project Euler Problem16  (0) 2015.02.24
Project Euler Problem15  (0) 2015.02.17
Project Euler Problem9  (0) 2015.02.15
Project Euler Problem5  (0) 2015.02.12
Project Euler Problem7  (0) 2015.02.05
Project Euler Problem6  (0) 2015.02.05