| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 67532 | 王籽易 | 采药 | C++ | Accepted | 100 | 0 MS | 248 KB | 300 | 2023-01-14 00:04:23 |
#include<bits/stdc++.h> using namespace std; int m,t; int w[101],v[101],dp[1001]; int main(){ cin>>t>>m; for(int i=1;i<=m;i++){ cin>>v[i]>>w[i]; } for(int i=1;i<=m;i++){ for(int j=t;j>=0;j--){ if(j>=v[i]) dp[j]=max(dp[j-v[i]]+w[i],dp[j]); } } cout<<dp[t]; return 0; }