| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 146531 | 吴悠 | 收益 | C++ | Accepted | 100 | 0 MS | 244 KB | 514 | 2024-05-12 12:08:17 |
#include<iostream> #include<cstring> using namespace std; int a[11],b[11],dp[1001]; //a:价值 b:年收益 int main(){ int t; cin>>t; for(int k=1;k<=t;k++){ memset(dp,0,sizeof(dp)); int st,n,d; cin>>st>>n; cin>>d; for(int i=1;i<=d;i++){ cin>>a[i]>>b[i]; } for(int y=1;y<=n;y++){ for(int i=1;i<=d;i++){ for(int j=a[i];j<=st;j+=1000){ dp[j/1000]=max(dp[j/1000],dp[(j-a[i])/1000]+b[i]); } } st+=dp[st/1000]; } cout<<st<<endl; } return 0; }