11401 - Triangle Counting
Calculate the number of non-congruent non-degenerate scalene triangles with integer sides with maximum side length n.
The number of triangles with longest side is for as long as that sequence remains positive. Notice that, for , . From here, find a recurrence relation (or two) for and solve it to be able to complete the problem within the time limit.
- The program should terminate for any input value less than 3, but 3 itself needs to be processed.
- Using long long integers is sufficient for the problem.
5 8 3 1000000 2
3 22 0 83332958333750000