CT082

Pythagorean Triplet Product

MediumAcceptance: 0.0%

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which a^2 + b^2 = c^2. For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. Given a target sum N = a + b + c, find the product a * b * c. You may assume exactly one such triplet exists for the given N.

Example 1:

Input: 12
Output: 60

Example 2:

Input: 1000
Output: 31875000

Example 3:

Input: 30
Output: 780

Constraints:

12 <= N <= 10^6, N is even

Tags:

math pythagorean number-theory
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki