| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 67315 | 梅煦洋 | 采药 | C++ | Runtime Error | 0 | 0 MS | 92 KB | 457 | 2023-01-12 16:17:19 |
#include<bits/stdc++.h> using namespace std; int timer[101],value[101],dp[10001][10001]={0}; int main(){ int m,n,num; freopen("medic.in","r",stdin); freopen("medic.out","w",stdout); cin>>m>>n; for(int i=1;i<=n;i++){ cin>>timer[i]>>value[i]; } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(timer[i]<=j) dp[i][j]=max(dp[i-1][j],dp[i-1][j-timer[i]]+value[i]); else dp[i][j]=dp[i-1][j]; } } cout<<dp[n][m]<<endl; }