TopcoderArchiveVisit Topcoder
Archive
Algorithm problem

TopCooler

Problem statement, definition, constraints, and public examples.

Problem Statement

PROBLEM STATEMENT

Based on the success of the TopCoder site, TopCooler Company Inc. has decided
to run online contests. Contestants are given a fixed amount of time to invent
a new drink recipe using either coffee, or tea with cream and sugar (tea plus
plus). Contestants are rated and placed in either division I or division II.
The bean counters at TopCooler want to know what the potential payout for a
contest is based on the number of division I and division II contestants
currently registered.

The following rules apply when determining the payout.

1. If more than 512 total contestants are registered, trim the number of
contestants down to 512 by first reducing the number of division II entrants
(to zero if necessary), then division I entries.
2. If there are less than 4 total entries, the contest will be cancelled and
the method should return 0.
3. If there are less than 4 entrants in division I and less than 4 entrants in
division II, place all contestants in division I.
4. If rule 3 above does not apply, and there are less than 4 entrants in a
division, move those contestants to the other division.
5. Within each division, divide the contestants into groups of no more than
eight, but as close to eight as possible without going over.
6. The payout for each division I room is 23. The payout for each division II
room is 13.
7. The payout returned is the sum of all room payouts.

DEFINITION
Class Name: TopCooler
Method Name: payout
Parameters: int, int
Returns: int
Method signature (be sure your method is public): int payout(int divI, int
divII);  

TopCoder will check that both divI and divII are from 0 to 1000 inclusive (0 <=
n <= 1000).

EXAMPLES

payout(1, 2) ==> 0          not enough contestants (rule 2)
payout(3, 2) ==> 23         divII moved to divI (rule 3)
payout(2, 6) ==> 13         divI moved to divII (rule 4)
payout(256, 257) ==> 1152   divII reduced to 256 (rule 1)
payout(10, 23) ==> 85
payout(45, 74) ==> 268

Definition

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

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems