Statistics

Problem Statement for "BisquareSums"

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. 1

    5

    Returns: 4

    02 + 12 = 1 02 + 22 = 4 12 + 12 = 2 12 + 22 = 5

  2. 7

    7

    Returns: 0

    7 is not a bisquare.

  3. 23

    99

    Returns: 30

  4. 56

    99

    Returns: 16

  5. 1

    100

    Returns: 43

  6. 56

    56

    Returns: 0

  7. 20

    20

    Returns: 1

  8. 59

    79

    Returns: 7

  9. 7

    7

    Returns: 0

  10. 53

    99

    Returns: 17

  11. 13

    39

    Returns: 12

  12. 67

    92

    Returns: 10

  13. 100

    100

    Returns: 1

  14. 99

    99

    Returns: 0

  15. 1

    1

    Returns: 1

  16. 1

    99

    Returns: 42

  17. 2

    59

    Returns: 26

  18. 1

    3

    Returns: 2

  19. 67

    70

    Returns: 1

  20. 90

    100

    Returns: 4

  21. 98

    100

    Returns: 2

  22. 2

    99

    Returns: 41

  23. 12

    94

    Returns: 33

  24. 27

    38

    Returns: 5

  25. 17

    19

    Returns: 2

  26. 64

    69

    Returns: 3

  27. 12

    55

    Returns: 19

  28. 1

    30

    Returns: 15

  29. 100

    100

    Returns: 1

  30. 8

    8

    Returns: 1

  31. 1

    100

    Returns: 43

  32. 56

    99

    Returns: 16

  33. 1

    30

    Returns: 15

  34. 100

    100

    Returns: 1

  35. 8

    8

    Returns: 1

  36. 1

    100

    Returns: 43

  37. 56

    99

    Returns: 16


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: