luogu#P5228. [AHOI2013] 找硬币
[AHOI2013] 找硬币
Problem Description
Little Snake is the minister of the finance department. Recently, she decided to create a series of new currencies. Suppose the denominations she will create are . Then must be , and must be a positive integer multiple of (). For example, is a valid coin sequence, while is not.
Starting from some day, the lovely Snake fell in love with a cute thing—“rabbit dolls” (tu zi)! From then on, she took the one-way path of buying any rabbit doll she encountered. One day, she saw cute rabbit dolls. Suppose the prices of these rabbit dolls are . Now she wants to know: under which valid coin sequence, the total number of coins needed to buy these rabbit dolls is the smallest. No change can be given when buying rabbit dolls.
Input Format
The first line contains an integer , representing the number of rabbit dolls.
The second line contains integers separated by spaces, representing the prices of the rabbit dolls.
Output Format
One line containing an integer, representing the minimum number of coins paid.
2
25 102
4
Hint
.
.
Translated by ChatGPT 5