Statistics

Problem Statement for "FoodCollecting"

Problem Statement

As a serious strategy-games player, you know how important it is to gather enough food for your army before any invasion. Because of this, you decided to collect at least neededFood units of food for your soldiers.

At the beginning, you have n workers to help you. In a single round, each of your workers gathers one unit of food. At the end of each round, you can trade some of your food for new workers. Hiring a single new worker costs price units of food. You can purchase any amount of new workers as long as you have the food to pay for it.

Return the minimum number of rounds you need to gather at least neededFood units of food.

Definition

Class:
FoodCollecting
Method:
gather
Parameters:
long, int, int
Returns:
int
Method signature:
int gather(long neededFood, int n, int price)
(be sure your method is public)

Constraints

  • neededFood, n and price will each be between 1 and 1000, inclusive.

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: