Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
35425 陈柏诚 采药 C++ 解答错误 83 74 MS 312 KB 260 2021-12-15 13:43:12

Tests(10/12):


#include <bits/stdc++.h> using namespace std; int main() { int f[10001]; 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; }


测评信息: