103311: [Atcoder]ABC331 B - Buy One Carton of Milk
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:13
Solved:0
Description
Score : $200$ points
Problem Statement
A supermarket sells egg packs.
A pack of $6$ eggs costs $S$ yen, a pack of $8$ eggs costs $M$ yen, and a pack of $12$ eggs costs $L$ yen.
When you can buy any number of each pack, find the minimum amount of money required to purchase at least $N$ eggs.
Constraints
- $1 \leq N \leq 100$
- $1 \leq S,M,L \leq 10^4$
- All input values are integers.
Input
The input is given from Standard Input in the following format:
$N$ $S$ $M$ $L$
Output
Print the answer.
Sample Input 1
16 120 150 200
Sample Output 1
300
It is optimal to buy two $8$-egg packs.
Sample Input 2
10 100 50 10
Sample Output 2
10
It is optimal to buy one $12$-egg pack.
Sample Input 3
99 600 800 1200
Sample Output 3
10000
It is optimal to buy five $8$-egg packs and five $12$-egg packs.
Output
分数:$200$分
问题描述
一家超市出售鸡蛋包装。
一包$6$个鸡蛋售价为$S$日元,一包$8$个鸡蛋售价为$M$日元,一包$12$个鸡蛋售价为$L$日元。
当你可以购买任意数量的每包时,找出购买至少$N$个鸡蛋所需的最低金额。
限制条件
- $1 \leq N \leq 100$
- $1 \leq S,M,L \leq 10^4$
- 所有的输入值都是整数。
输入
输入将从标准输入以以下格式给出:
$N$ $S$ $M$ $L$
输出
打印答案。
样例输入 1
16 120 150 200
样例输出 1
300
最优方案是购买两包$8$个鸡蛋。
样例输入 2
10 100 50 10
样例输出 2
10
最优方案是购买一包$12$个鸡蛋。
样例输入 3
99 600 800 1200
样例输出 3
10000
最优方案是购买五包$8$个鸡蛋和五包$12$个鸡蛋。
HINT
6、8、12个鸡蛋价格分别是S、M、L,购买至少n个鸡蛋需要多少钱?