Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
35439 陈柏诚 采药 C++ 通过 100 68 MS 328 KB 275 2021-12-15 13:47:25

Tests(12/12):


#include <bits/stdc++.h> using namespace std; int f[10001]; int main() { int m,n,w,c; cin>>m>>n; for(int i=1; i<=n; i++) { cin>>w>>c; for(int j=m; j>=w; --j) { f[j]=max(f[j-w]+c,f[j]); } } cout<<f[m]<<'\n'; return 0; }


测评信息: