You are viewing a single comment's thread. Return to all comments →
Solved this problem in F# using Euclid's formula to generate primitive Pythagorean triplets, for each increasing the triplet count of the appropriate lenghts (ie, multiples of the sum of the triplet values). With some simple DP, one then has all answers precalculated.
Note that this last part is useful in this particular problem, since the number of tests can be high (10^5).