You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
629 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
/*
由于老师只能买一种包装的铅笔,因此直接枚举买哪种包装,然后求出最少需要买多少包,才能使总数量不少于 n
即可。其中 n 是老师需要买的铅笔总数。
假设当前枚举的包装中的铅笔是 s 个,则最少需要买 ⌈n/s⌉=⌊(n+s1)/s⌋ 包。
*/
int main() {
int n;
scanf("%d", &n);
int res = 1e9;
for (int i = 0; i < 3; i++) {
int s, p;
scanf("%d%d", &s, &p);
res = min(res, (n + s - 1) / s * p);
}
printf("%d\n", res);
return 0;
}