Right-angled Triangle
A triangle is one of the basic shapes of geometry: a polygon with three corners or vertices and three sides or edges which are line segments. A triangle with vertices A, B and C is denoted as △ABC.
Triangles can also be classified according to their internal angles, described below using degrees of arc:
A right triangle (or right-angled triangle) has one 90° internal angle (a right angle). The side opposite to the right angle is the hypotenuse; it is the longest side in the right triangle. The other two sides are the legs or catheti (singular: cathetus) of the triangle. Right triangles conform to the Pythagorean Theorem, wherein the sum of the squares of the two legs is equal to the square of the hypotenuse, i.e.
a^2
+b^2
=c^2
, where a and b are the legs and c is the hypotenuse.An oblique triangle has no internal angle equal to 90°.
An obtuse triangle is an oblique triangle with one internal angle larger than 90° (an obtuse angle).
An acute triangle is an oblique triangle with internal angles all smaller than 90° (three acute angles). An equilateral triangle is an acute triangle, but not all acute triangles are equilateral triangles.
What we consider here is very simple. Give you the length of L, you should calculate there are how many right-angled triangles such that a + b + c ≤ L where a and b are the legs and c is the hypotenuse. You should note that the three numbers a, b and c are all integers.
Input
There are multiple test cases. For each test case, the first line is an integer L (12 ≤ L ≤ 2 * 10^6
), indicating the length of L.
Output
For each test case, output the number of right-angled triangles such that a + b + c ≤ L where a and b are the legs and c is the hypotenuse.
Hint
There are five right-angled triangles with a + b + c ≤ 40. They are:
a = 3, b = 4, c = 5
a = 6, b = 8, c = 10
a = 5, b = 12, c = 13
a = 9, b = 12, c = 15
a = 8, b = 15, c = 17