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
480 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
int a, b, c, d, e, f, g, h, i;
scanf("%d %d %d %d %d %d", &a, &b, &d, &e, &g, &h);
//第一组
c = (n % a == 0 ? n / a : n / a + 1) * b;
//第二组
f = (n % d == 0 ? n / d : n / d + 1) * e;
//第三组
i = (n % g == 0 ? n / g : n / g + 1) * h;
//取最小值时的办法
printf("%d\n", min({c, f, i}));
return 0;
}