Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
142035 方文轩 采药 C++ 运行出错 83 0 MS 252 KB 253 2024-04-06 16:04:41

Tests(10/12):


#include<bits/stdc++.h> using namespace std; int w[1005],c[1005],s[1005],m,x; int main(){ cin>>m>>x; for(int i=1;i<=x;i++) cin>>w[i]>>c[i]; for(int i=1;i<=x;i++) for(int j=m;j>=w[i];j--) s[j]=max(s[j],s[j-w[i]]+c[i]); cout<<s[m]; }


测评信息: