#P2134. Holiday Cost Minimization
Holiday Cost Minimization
Holiday Cost Minimization
During their holiday, Xiaoming and Xiaohong have n days remaining. Xiaoming can plan his travel. If he travels for x consecutive days, he must spend \(p \times x^2\) yuan; if he does not travel for x consecutive days, he must treat Xiaohong, costing \(q \times x\) yuan. Determine the minimum total cost Xiaoming must spend during the holiday by choosing which days to travel and which days not to travel.
inputFormat
The input consists of a single line containing three integers: \(n\), \(p\), and \(q\), where \(n\) is the number of holiday days, and \(p, q\) are the cost coefficients.
outputFormat
Output a single integer representing the minimum cost required.
sample
3 1 1
3