Statistics

Problem Statement for "RugSizes"

Problem Statement

Rugs come in various sizes. In fact, we can find a rug with any integer width and length, except that no rugs have a distinct width and length that are both even integers. For example, we can find a 4x4 rug, but not a 2x4 rug. We want to know how many different choices we have for a given area.

Create a class RugSizes the contains a method rugCount that is given the desired area and returns the number of different ways in which we can choose a rug size that will cover that exact area. Do not count the same size twice -- a 6 x 9 rug and a 9 x 6 rug should be counted as one choice.

Definition

Class:
RugSizes
Method:
rugCount
Parameters:
int
Returns:
int
Method signature:
int rugCount(int area)
(be sure your method is public)

Constraints

  • area will be between 1 and 100,000, inclusive.

Examples

  1. 4

    Returns: 2

    The choices are 1 x 4 (or equivalently 4 x 1) and 2 x 2.

  2. 8

    Returns: 1

    Only 1 x 8 is available. Note that 2 x 4 has the desired area, but is not available since its width and length differ and are both even numbers.

  3. 30

    Returns: 4

  4. 100000

    Returns: 6

  5. 98415

    Returns: 10

  6. 6241

    Returns: 2

  7. 99997

    Returns: 3

  8. 99991

    Returns: 1

  9. 64

    Returns: 2

  10. 4096

    Returns: 2

  11. 8192

    Returns: 1

  12. 8193

    Returns: 2

  13. 1

    Returns: 1

  14. 2

    Returns: 1

  15. 5

    Returns: 1

  16. 100000

    Returns: 6

  17. 1

    Returns: 1

  18. 26

    Returns: 2

  19. 16

    Returns: 2

  20. 15

    Returns: 2

  21. 30

    Returns: 4

  22. 9

    Returns: 2

  23. 21

    Returns: 2

  24. 10

    Returns: 2

  25. 99999

    Returns: 6

  26. 25

    Returns: 2

  27. 56

    Returns: 2

  28. 81

    Returns: 3

  29. 500

    Returns: 4

  30. 125

    Returns: 2

  31. 97

    Returns: 1

  32. 4

    Returns: 2

  33. 45

    Returns: 3

  34. 18

    Returns: 3

  35. 98456

    Returns: 4

  36. 32420

    Returns: 4

  37. 6

    Returns: 2

  38. 121

    Returns: 2

  39. 36

    Returns: 4

  40. 35

    Returns: 2

  41. 12

    Returns: 2

  42. 72

    Returns: 3

  43. 41472

    Returns: 5

  44. 27

    Returns: 2

  45. 20

    Returns: 2

  46. 1296

    Returns: 6

  47. 64

    Returns: 2

  48. 194

    Returns: 2

  49. 2

    Returns: 1

  50. 54

    Returns: 4

  51. 100

    Returns: 4

  52. 1365

    Returns: 8

  53. 100000

    Returns: 6

  54. 1

    Returns: 1

  55. 26

    Returns: 2

  56. 16

    Returns: 2

  57. 15

    Returns: 2

  58. 30

    Returns: 4

  59. 9

    Returns: 2

  60. 21

    Returns: 2

  61. 10

    Returns: 2

  62. 99999

    Returns: 6

  63. 25

    Returns: 2

  64. 56

    Returns: 2

  65. 81

    Returns: 3

  66. 500

    Returns: 4

  67. 125

    Returns: 2

  68. 97

    Returns: 1

  69. 4

    Returns: 2

  70. 45

    Returns: 3

  71. 18

    Returns: 3

  72. 98456

    Returns: 4

  73. 32420

    Returns: 4

  74. 6

    Returns: 2

  75. 121

    Returns: 2

  76. 36

    Returns: 4

  77. 35

    Returns: 2

  78. 12

    Returns: 2

  79. 72

    Returns: 3

  80. 41472

    Returns: 5

  81. 27

    Returns: 2

  82. 20

    Returns: 2

  83. 1296

    Returns: 6

  84. 64

    Returns: 2

  85. 194

    Returns: 2

  86. 2

    Returns: 1

  87. 54

    Returns: 4

  88. 100

    Returns: 4

  89. 1365

    Returns: 8


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: