Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
67317 季洁 开心的金明 C++ Accepted 100 1 MS 456 KB 252 2023-01-12 16:17:38

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int dp[30010],t,m; int main(){ cin>>t>>m; for(int i=1;i<=m;i++){ int ti,vi; cin>>ti>>vi; for(int j=t;j>=1;j--) if(j>=ti) dp[j]=max(dp[j],dp[j-ti]+vi*ti); } cout<<dp[t]; return 0; }


Judgement Protocol: