#P15731. [JAG 2024 Summer Camp #2] Convenient Banknotes
[JAG 2024 Summer Camp #2] Convenient Banknotes
Description
In the Kingdom of JAG, only -yen banknotes have been issued so far. However, due to the increase in the circulation of banknotes, the kingdom has decided to renew its banknote system entirely. The new banknote system is represented by a sequence of positive integers . This means that the new system uses types of banknotes with denominations of yen. You can decide the number of banknote types and their values under the following restrictions:
- is a positive integer.
- .
- must be a multiple of ().
In the Kingdom of JAG, goods are often traded at prices of , , or yen. Therefore, the inconvenience of the new banknote system is defined as:
(The minimum number of banknotes required to represent yen) + (The minimum number of banknotes required to represent yen) + (The minimum number of banknotes required to represent yen).
Your task is to find the minimum possible value of this inconvenience.
Input Format
The input is given in the following format:
- All input values are integers.
Output Format
Output a single line with the minimum possible value of the inconvenience for the new banknote system.
6 11 15
6
99999959 99999971 99999989
11
京公网安备 11011102002149号