Time limit per test
3 seconds
Memory limit per test
256 megabytes
Input
Standard Input
Output
Standard output
In mathematics, the Pythagorean theorem-is a relation in Euclidean Geometry among the three sides of a right-angled triangle. In terms of areas, it states:
In any right-angled triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (
Two sides that meet at a right angle ).
The theorem can be written as an equation relating the lengths of the sidesA,BAndC,
Often called the Pythagorean equation:
A2Region + Region
B2Signature = Signature
C2
WhereCRepresents the length of the hypotenuse, andAAndBRepresent
The lengths of the other two sides.
GivenN, Your task is to count how many right-angled triangles with side-lengthsA,BAndCThat
Satisfied an inequality1 bytes ≤ bytesALimit ≤ limitBLimit ≤ limitCLimit ≤ limitN.
Input
The only line contains one integerN(1 digit ≤ DigitNLimit ≤ limit 104)As
We mentioned above.
Output
Print a single integer-the answer to the problem.
Sample test (s) Input
5
Output
1
Input
74
Output
35
Problem solving Description: This is to judge how many numbers in the N range can constitute a right triangle, just use brute force.
# include
# include
# include
# include
# include
using namespace STD; int main () {int N, I, J, K, H = 0; float D; scanf ("% d", & N); for (I = 1; I