Statistics

Problem Statement for "FryingHamburgers"

Problem Statement

In order to cook hamburgers, a chef must fry them 5 minutes on each side. However, the two 5 minute intervals do not have to happen consecutively.

panSize indicates how many hamburgers can fit into the given pan, while hamburgers represents the number of hamburgers that need to be fried. Given panSize and hamburgers return the minimum amount of time (in minutes) required to fry all the hamburgers.

Definition

Class:
FryingHamburgers
Method:
howLong
Parameters:
int, int
Returns:
int
Method signature:
int howLong(int panSize, int hamburgers)
(be sure your method is public)

Constraints

  • panSize is between 1 and 1000 inclusive.
  • hamburgers is between 0 and 1000 inclusive.

Examples

  1. 2

    3

    Returns: 15

    We will assume that the three hamburgers given are A, B and C. The chef could fry A and B on one side, taking up 5 minutes. Then remove B and fry A on its second side together with C on its first side. After 5 minutes, remove A and fry B and C on their second sides for another 5 minutes. The total time used is 15 minutes.

  2. 3

    4

    Returns: 15

    We will assume that the four hamburgers given are A, B, C and D. The chef could fry A, B and C on one side, taking up 5 minutes. Then remove C and fry A and B on their second side together with D on its first side. So after a total of 10 minutes A and B are completely fried, while C and D are fried on one side only. Finally, the chef fries C and D on their second side, taking another 5 minutes. The total time used is 15 minutes.

  3. 3

    2

    Returns: 10

  4. 100

    0

    Returns: 0

    There are no hamburgers, so we do not have to fry anything.

  5. 3

    8

    Returns: 30

  6. 925

    945

    Returns: 15

  7. 303

    919

    Returns: 35

  8. 493

    820

    Returns: 20

  9. 23

    420

    Returns: 185

  10. 750

    597

    Returns: 10

  11. 11

    206

    Returns: 190

  12. 56

    808

    Returns: 145

  13. 367

    734

    Returns: 20

  14. 1

    1

    Returns: 10

  15. 1

    0

    Returns: 0

  16. 1000

    1

    Returns: 10

  17. 1000

    0

    Returns: 0

  18. 1

    1000

    Returns: 10000

  19. 619

    932

    Returns: 20

  20. 840

    312

    Returns: 10

  21. 525

    620

    Returns: 15

  22. 1000

    1000

    Returns: 10

  23. 999

    1000

    Returns: 15

  24. 566

    962

    Returns: 20

  25. 73

    522

    Returns: 75

  26. 224

    410

    Returns: 20

  27. 500

    1000

    Returns: 20

  28. 160

    874

    Returns: 55

  29. 113

    454

    Returns: 45

  30. 517

    805

    Returns: 20

  31. 20

    652

    Returns: 330

  32. 6

    64

    Returns: 110

  33. 24

    716

    Returns: 300

  34. 475

    652

    Returns: 15

  35. 442

    507

    Returns: 15

  36. 228

    508

    Returns: 25

  37. 499

    1000

    Returns: 25

  38. 501

    1000

    Returns: 20

  39. 501

    756

    Returns: 20

  40. 606

    670

    Returns: 15

  41. 438

    629

    Returns: 15

  42. 2

    1

    Returns: 10

  43. 3

    1

    Returns: 10

  44. 10

    1

    Returns: 10

  45. 4

    2

    Returns: 10

  46. 100

    1

    Returns: 10

  47. 40

    1

    Returns: 10

  48. 5

    2

    Returns: 10

  49. 1

    2

    Returns: 20

  50. 10

    0

    Returns: 0

  51. 6

    3

    Returns: 10

  52. 10

    19

    Returns: 20

  53. 300

    17

    Returns: 10

  54. 5

    8

    Returns: 20

  55. 4

    11

    Returns: 30

  56. 5

    1

    Returns: 10


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: