Files
python/TangDou/CSP-J/AcWingTraining/T4/465.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

24 lines
629 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
/*
由于老师只能买一种包装的铅笔,因此直接枚举买哪种包装,然后求出最少需要买多少包,才能使总数量不少于 n
即可。其中 n 是老师需要买的铅笔总数。
假设当前枚举的包装中的铅笔是 s 个,则最少需要买 ⌈n/s⌉=⌊(n+s−1)/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;
}