Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
142144 吴宗桦 简单背包问题 C++ 解答错误 0 0 MS 268 KB 252 2024-04-06 17:00:21

Tests(0/5):


#include<bits/stdc++.h> using namespace std; int a,b,c,d[10035],e[10004],f,g,h[10001]; int main() { cin>>a>>b; for(c=1;c<=b;c++) { cin>>d[c]>>e[c]; for(f=a;f>=d[c];f--) h[f]=max(h[f],h[f-d[c]]+e[c]); } cout<<h[a]; return 0; }


测评信息: