Description:
Ali is given the following homework by his Math teacher:
Given an integer \(n\), count how many pairs ( \(x\) , \(y\) ) such that \(x^2 + y^2 = n^2\), where \(1 \leq x,y \leq n\). Can you help Ali solve this problem?
Program Input:
A signle line that contains the integer \(n\)
Constraints:
\(1 \leq n \leq 10^4\)
Program Output:
A single line that contains the number of pairs.
Sample Testcase 0:
Input:
10
Output:
1
Explanation:
There exists only one pair ( \(6\) , \(8\) ) such that \(6^2 + 8^2 = 10^2\)
Note that we consider ( \(6\) , \(8\) ) and ( \(8\) , \(6\) ) to be the same pair.
Sample Testcase 1:
Input:
100
Output:
2
Explanation:
two pairs:
\(28^2 + 96^2 = 100^2\)
\(60^2 + 80^2 = 100^2\)
Information
Author(s) | Dr. Fahed Jubair |
Deadline | No deadline |
Submission limit | No limitation |