Statistics

Problem Statement for "Insomnia"

Problem Statement

When I can't sleep I count sheep. During the first hour I count 900 sheep (I start at 1 and count up: 1, 2, 3, ..., 899, 900). During the next hour I count them down (so as to avoid having my numbers of sheep grow too large), that is, I count 899, 898 etc. As I count down slower than up, I count 600 sheep down during the second hour. Then I count up again, and so forth.

Your task is, given the number of minutes I spend trying to get to sleep, return the final number of sheep where I stop counting.

Definition

Class:
Insomnia
Method:
sheepCount
Parameters:
int
Returns:
int
Method signature:
int sheepCount(int minutes)
(be sure your method is public)

Notes

  • Assume that each hour I count evenly: either 15 sheep a minute up, or 10 sheep a minute down.

Constraints

  • minutes is between 0 and 720, inclusive.

Examples

  1. 0

    Returns: 0

  2. 120

    Returns: 300

  3. 2

    Returns: 30

  4. 185

    Returns: 1150

  5. 1

    Returns: 15

  6. 59

    Returns: 885

  7. 60

    Returns: 900

  8. 61

    Returns: 890

  9. 119

    Returns: 310

  10. 121

    Returns: 315

  11. 179

    Returns: 1185

  12. 180

    Returns: 1200

  13. 181

    Returns: 1190

  14. 239

    Returns: 610

  15. 240

    Returns: 600

  16. 241

    Returns: 615

  17. 299

    Returns: 1485

  18. 300

    Returns: 1500

  19. 301

    Returns: 1490

  20. 599

    Returns: 1510

  21. 600

    Returns: 1500

  22. 601

    Returns: 1515

  23. 719

    Returns: 1810

  24. 720

    Returns: 1800

  25. 467

    Returns: 1330

  26. 150

    Returns: 750


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: