Statistics

Problem Statement for "Contest"

Problem Statement

PROBLEM STATEMENT

A room assignment is a partition of the contestants into rooms where the number
of contestants in each room does not exceed the maximum room size.  Given the
maximum room size and the number of contestants, determine the size of the
smallest room in a room assignment that meets the following conditions, in
order of decreasing priority:

1.  The number of rooms is minimized.

2.  The difference between the number of contestants in the largest and
smallest rooms is minimized.

If the number of contestants is zero, return 0.

DEFINITION

Class: Contest
Method name: smallestRoom
Parameters: int, int
Returns: int
Method signature (be sure your method is public): int smallestRoom(int
maxRoomSize, int numContestants);

NOTES

Topcoder will ensure that:
* 1 <= maxRoomSize <= 1000000
* 0 <= numContestants <= 1000000000

EXAMPLES

1.  maxRoomSize    = 8
    numContestants = 16
    Method returns 8

2.  maxRoomSize    = 8
    numContestants = 13
    Method returns 6

3.  maxRoomSize    = 8
    numContestants = 49
    Method returns 7

4.  maxRoomSize    = 1
    numContestants = 1000
    Method returns 1

5.  maxRoomSize    = 1000
    numContestants = 1
    Method returns 1

Definition

Class:
Contest
Method:
smallestRoom
Parameters:
int, int
Returns:
int
Method signature:
int smallestRoom(int param0, int param1)
(be sure your method is public)

Constraints

    Examples


      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: