#P11112. Robot Delivery Profit Maximization
Robot Delivery Profit Maximization
Robot Delivery Profit Maximization
The Robot Delivery Profit Maximization problem involves a robot company that earns (p) virtual tokens for every completed order, while cloning a new robot costs (c) virtual tokens. The final profit is calculated as the total revenue from delivered orders minus the total cost of all robot clones. Initially, the company has one robot available without any cloning cost. To deliver additional orders, the company may choose to clone new robots as needed. Given that there are (n) available orders, the company does not need to complete all orders, and the robots can stop delivering at any point.
For the first order, no cloning is required and the profit is (p). For every subsequent order, a cloning cost of (c) tokens is incurred, so the profit for delivering (k) orders (with (k \ge 1)) is given by:
[
\text{profit} = p + (k - 1) \times (p - c).
]
If (p - c > 0), delivering more orders increases profit, and the optimal strategy is to deliver all (n) orders. Otherwise, if (p - c \le 0), it is best to deliver only the first order (if (p > 0)) or none at all. Your task is to determine the maximum profit obtainable by the company.
inputFormat
The input consists of a single line containing three space-separated integers: (n), (p), and (c), where:
- \(n\) (\(n \ge 0\)) is the total number of available orders,
- \(p\) (\(p \ge 0\)) is the revenue in virtual tokens for each completed order, and
- \(c\) (\(c \ge 0\)) is the cost in virtual tokens to clone a new robot.
outputFormat
Output a single integer representing the maximum profit the company can achieve.
sample
5 10 6
26