Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
433357 叶梓皓 【C6-11】采药 C++ 解答错误 10 1 MS 252 KB 309 2026-03-20 21:36:51

Tests(1/10):


#include<bits/stdc++.h> using namespace std; int t,m,a[105],b[105],f[105]; int main(){ cin>>t>>m; for(int i=1;i<=m;i++){ cin>>a[i]>>b[i]; } for(int i=1;i<=m;i++){ for(int j=t;j>=a[i];j--){ f[j]=max(f[j],f[j-a[i]]+b[i]); } } cout<<f[t]; return 0; }


测评信息: