| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 67311 | 杨竣周 | 采药 | C++ | Wrong Answer | 10 | 0 MS | 264 KB | 358 | 2023-01-12 16:15:55 |
#include<bits/stdc++.h> using namespace std; int t,m,p[101],v[101],dp[101][110]; 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; }