#P7777. Rin's Stone Game
Rin's Stone Game
Rin's Stone Game
Rin and his father used to play a stone game on Earth. In this game, there are n piles of stones numbered from 1 to n. In each move, Rin can remove stones in one of two ways:
- Remove a single pile i at a cost of $i \times p$.
- Remove two piles i and j at a cost of $|i-j| \times q$.
The goal is to remove all the piles with a minimum total cost. Here, p and q are given positive integers. With disaster looming, you have only 0.3 seconds to help Rin compute the answer!
inputFormat
The input consists of three space‐separated integers: n, p, and q, where n is the number of stone piles and p and q are the cost coefficients.
outputFormat
Output a single integer representing the minimum total cost required to remove all the stone piles.
sample
3 1 0
1