标签:ace scanf define efi main cst mys ref str
#include <iostream>
#include <cstdio>
using namespace std;
//Mystery_Sky
//
#define M 100000
int f[M], c[M];
int v, m;
int main() {
scanf("%d%d", &v, &m);
for(int i = 1; i <= m; i++) scanf("%d", &c[i]);
for(int i = 1; i <= m; i++)
for(int j = v; j >= c[i]; j--)
f[j] = max(f[j], f[j-c[i]]+c[i]);
printf("%d\n", v - f[v]);
return 0;
}
标签:ace scanf define efi main cst mys ref str
原文地址:https://www.cnblogs.com/Benjamin-cpp/p/10841079.html