Problem Statement
An integer b is a bisquare if two (possibly equal) integers x and y exist such that x2 + y2 = b. Given two int s, 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 = 5
7
7
Returns: 0
7 is not a bisquare.
23
99
Returns: 30
56
99
Returns: 16
1
100
Returns: 43
56
56
Returns: 0
20
20
Returns: 1
59
79
Returns: 7
7
7
Returns: 0
53
99
Returns: 17
13
39
Returns: 12
67
92
Returns: 10
100
100
Returns: 1
99
99
Returns: 0
1
1
Returns: 1
1
99
Returns: 42
2
59
Returns: 26
1
3
Returns: 2
67
70
Returns: 1
90
100
Returns: 4
98
100
Returns: 2
2
99
Returns: 41
12
94
Returns: 33
27
38
Returns: 5
17
19
Returns: 2
64
69
Returns: 3
12
55
Returns: 19
1
30
Returns: 15
100
100
Returns: 1
8
8
Returns: 1
1
100
Returns: 43
56
99
Returns: 16
1
30
Returns: 15
100
100
Returns: 1
8
8
Returns: 1
1
100
Returns: 43
56
99
Returns: 16