| 比赛 | 叫图论的DP题 | 评测结果 | AAAAAAAAAAA | 
|---|---|---|---|
| 题目名称 | Bessie 的体重问题 | 最终得分 | 100 | 
| 用户昵称 | kZime | 运行时间 | 0.054 s | 
| 代码语言 | C++ | 内存使用 | 0.48 MiB | 
| 提交时间 | 2017-08-30 19:50:36 | ||
# include <cstdio>
# include <algorithm>
# define MAXN 45023
using namespace std;
int f[MAXN], n, m, *a = new int();
int main() { 
    freopen("diet.in", "r", stdin);
    freopen("diet.out", "w", stdout);
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= m; i++) { 
        scanf("%d", a);
        for(int j = n; j >= *a; j--) { 
            f[j] = max(f[j], f[j - *a] + *a);
        }
    }
    printf("%d\n", f[n]);
}