Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
35756 流汗黄豆 采药 C++ 通过 100 67 MS 332 KB 282 2021-12-18 08:11:24

Tests(12/12):


#include <bits/stdc++.h> using namespace std; int f[10001]; int main() { int m,n,w,c; scanf("%d%d",&m,&n); for(int i=1; i<=n; i++) { scanf("%d%d",&w,&c); for(int j=m; j>=w; --j) f[j]=max(f[j-w]+c,f[j]); } printf("%d",f[m]); return 0; }


测评信息: