atcoder#AGC019A. [AGC019A] Ice Tea Store
[AGC019A] Ice Tea Store
Score : points
Problem Statement
You've come to your favorite store Infinitesco to buy some ice tea.
The store sells ice tea in bottles of different volumes at different costs. Specifically, a -liter bottle costs yen, a -liter bottle costs yen, a -liter bottle costs yen, and a -liter bottle costs yen. The store has an infinite supply of bottles of each type.
You want to buy exactly liters of ice tea. How many yen do you have to spend?
Constraints
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the smallest number of yen you have to spend to buy exactly liters of ice tea.
20 30 70 90
3
150
Buy one -liter bottle and two -liter bottles. You'll get liters for yen.
10000 1000 100 10
1
100
Even though a -liter bottle costs just yen, you need only liter. Thus, you have to buy a -liter bottle for yen.
10 100 1000 10000
1
40
Now it's better to buy four -liter bottles for yen.
12345678 87654321 12345678 87654321
123456789
1524157763907942