Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
35338 _JF_ 采药 C++ 通过 100 67 MS 332 KB 279 2021-12-14 19:26:57

Tests(12/12):


#include<iostream> using namespace std; const int N =1e6+10; int f[N]; int main() { int t,m, w, c; cin>>t>>m; for(int i=1;i<=m;i++) { cin >> w >> c; for (int j = t; j >= w; --j) f[j] = max(f[j], f[j - w] + c); } cout<<f[t] << endl; return 0; }


测评信息: