시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 1024 MB | 4 | 4 | 4 | 100.000% |
A Pythagorean triple is a set of three positive integers, a, b and c, for which:
a² + b² = c²
A Pythagorean triple is a Primitive Pythagorean Triple (PPT) if a, b and c have no common factors.
Write a program which takes as input a positive integer, n, and outputs a count of:
For the same a, b, c: b, a, c is the “same” as a, b, c (i.e it only counts once). Non-primitive Pythagorean triples are Pythagorean triples which are not PPT.
For example, in the case of n = 65, the following are the cases for each of the criteria above:
Input consists of a single line containing a single non-negative decimal integer n, (3 ≤ n ≤ 2500).
There is one line of output. The single output line contains four decimal integers:
The first is the number of different PPTs in which n is the hypotenuse ( c ).
The second is the number of non-primitive Pythagorean triples in which n is the hypotenuse ( c).
The third is the number of different PPTs in which n is the one of the sides ( a or b ).
The fourth is the number of non-primitive Pythagorean triples in which n is the one of the sides (a or b).
65
2 2 2 2
64
0 0 1 4
2023
0 2 2 5