공부/문제풀기

프로젝트 오일러 문제 9

아야카 2018. 11. 12. 00:00
728x90

Special Pythagorean triplet

Problem 9

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,

a2 + b2 = c2

For example, 32 + 42 = 9 + 16 = 25 = 52.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.

a+b+c=1000이 되는 피타고라스 수의 쌍을 찾아 세 수의 곱을 구하는 문제.
당연하지만 a, b, c는 모두 자연수다.


728x90