Problem Statement |
| | The hotel industry is difficult to thrive in, especially when competing at a resort city like Las Vegas.
Marketing is essential and often gets a large part of total revenues. You have a list of cities you can market at,
and a good estimate of how many customers you will get for a certain amount of money spent at each city.
You are given int[]s customers and cost. cost[i] is the amount of money required to get customers[i] customers from the i-th city. You are only allowed to spend integer multiples of the cost for any city. For example, if it costs 9 to get 3 customers from a certain city, you can spend 9 to get 3 customer, 18 to get 6 customers, 27 to get 9 customers, but not 3 to get 1 customer, or 12 to get 4 customers. Each city has an unlimited number of potential customers. Return the minimum amount of money required to get at least minCustomers customers. |
| |
Definition |
| | | Class: | Hotel | | Method: | marketCost | | Parameters: | int, int[], int[] | | Returns: | int | | Method signature: | int marketCost(int minCustomers, int[] customers, int[] cost) | | (be sure your method is public) |
|
| |
|
| |
Constraints |
| - | minCustomers will be between 1 and 1000, inclusive. |
| - | customers will contain between 1 and 20 elements, inclusive. |
| - | cost will have the same number of elements as customers. |
| - | Each element of cost and customers will be between 1 and 100, inclusive. |
| |
Examples |
| 0) | |
| | | Returns: 4 | | Just get 12 customers from the third city. |
|
|
| 1) | |
| | 10 | {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} | {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} |
| Returns: 10 | | It does not matter from which city you get your customers. |
|
|
| 2) | |
| | | Returns: 8 | | Get 10 customers from the first city, and 2 from the second city. |
|
|
| 3) | |
| | 100 | {9, 11, 4, 7, 2, 8} | {4, 9, 3, 8, 1, 9} |
| Returns: 45 | |
|