#abc251e. E - Takahashi and Animals
E - Takahashi and Animals
Score : points
问题描述
高桥有 只动物。这 只动物分别被称为动物 、动物 、、动物 。
高桥将执行以下 种类型的行动,每种行动可以执行任意次(可能为零次)。
- 花费 日元(日本货币)喂养动物 和 。
- 花费 日元喂养动物 和 。
- 花费 日元喂养动物 和 。
- 花费 日元喂养动物 和 。
- 花费 日元喂养动物 和 。
- 花费 日元喂养动物 和 。
- 花费 日元喂养动物 和 。
注意上述的第 个行动是喂养“动物 和 ”。
请输出至少喂养每只动物一次所需的最小总费用。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi is with animals. The animals are called Animal , Animal , , Animal .
Takahashi will perform the following kinds of action. Each action can be performed any number of (possibly zero) times.
- Pay yen (the currency in Japan) to feed Animals and .
- Pay yen to feed Animals and .
- Pay yen to feed Animals and .
- Pay yen to feed Animals and .
- Pay yen to feed Animals and .
- Pay yen to feed Animals and .
- Pay yen to feed Animals and .
Note that the -th action above feeds "Animals and ."
Print the minimum possible total cost to feed every animal at least once.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum possible total cost to feed every animal at least once.
Sample Input 1
5
2 5 3 2 5
Sample Output 1
7
If Takahashi performs the -st, -rd, and -th actions once each, Animals , , , , and are fed once, once, once, twice, once, respectively, so every animal is fed at least once. The total cost to do so is yen, which is the minimum possible.
Sample Input 2
20
29 27 79 27 30 4 93 89 44 88 70 75 96 3 78 39 97 12 53 62
Sample Output 2
426
update @ 2024/3/10 10:43:24