| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 67318 | 杨竣周 | 采药 | C++ | Accepted | 100 | 0 MS | 648 KB | 358 | 2023-01-12 16:17:57 |
#include<bits/stdc++.h> using namespace std; int t,m,p[101],v[101],dp[101][1001]; int main(){ scanf("%d %d",&t,&m); for(int i=1;i<=m;i++) scanf("%d %d",&p[i],&v[i]); for(int i=1;i<=m;i++){ for(int j=1;j<=t;j++){ dp[i][j]=dp[i-1][j]; if(j>=p[i])dp[i][j]=max(dp[i][j],dp[i-1][j-p[i]]+v[i]); } } printf("%d",dp[m][t]); return 0; }