#include <iostream>
#define rep(i, n) for (std::uint32_t i = 0; i < (n); ++i)
using ll = std::uint64_t;
template<class T, class U, typename std::enable_if_t<std::is_convertible<U, T>::value, nullptr_t>* = nullptr>
void chmin(T &a, const U &b) {
if (a > T(b)) a = T(b);
}
int main() {
int n, a, b, c;
std::cin >> n >> a >> b >> c;
int res = 10000;
rep(i, 10000) rep(j, 10000) {
ll value = ll(i) * a + ll(j) * b;
if (n < value || (n - value) % c != 0) continue;
chmin(res, i + j + (n - value) / c);
}
std::cout << res << std::endl;;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:18:11: warning: comparison of integer expressions of different signedness: ‘int’ and ‘ll’ {aka ‘long unsigned int’} [-Wsign-compare]
18 | if (n < value || (n - value) % c != 0) continue;
| ~~^~~~~~~