Problem Statement
An integer b is a bisquare if two (possibly equal) integers x and y exist such that x2 + y2 = b. Given two ints, low and high, return the number of distinct bisquares between low and high, inclusive.
Definition
- Class:
- BisquareSums
- Method:
- getSums
- Parameters:
- int, int
- Returns:
- int
- Method signature:
- int getSums(int low, int high)
- (be sure your method is public)
Constraints
- low will be between 1 and 100, inclusive.
- high will be between low and 100, inclusive.
Examples
1
5
Returns: 4
02 + 12 = 1 02 + 22 = 4 12 + 12 = 2 12 + 22 = 57
7
Returns: 0
7 is not a bisquare.23
99
Returns: 30
56
99
Returns: 16