MAT

Riddle #10

Given a number N, find the product of the numbers a, b and c that between them constitute a Pythagorean triple and whose sum is N.

If there is more than one combination, write the largest product. If there are no combinations, write 0.

Contraints

1 < N < 103

Example

Given N = 12, triplet:

3, 4, 5

has sum 12 and product:

60.

There is no Pythagorean triple with a major product.

Your program

<?php
    
function main($N) {

  $return = 0;
  /* Write your function here */
  
  return $return;
}
  
$IN = (array) json_decode(base64_decode($argv[1]));
extract($IN);
echo main($N);
?>

Your input

{ 
  "N": 12 
}

Your output

-

Correct output

60

0 0 votes
Article Rating
Notifiche
Notificami
0 Comments
Inline Feedbacks
View all comments