标签:name sizeof scan lld namespace -- include eof const
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define mem(a) memset(a,0,sizeof(a)) #define sc1(a) scanf("%lld",&a) #define sc2(a,b) scanf("%lld%lld",&a,&b) #define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c) const ll MAXN=1e9+7; const ll N=1e5+5; ll dp[N]; int main() { ll T,M,i,j; sc2(T,M); ll t[M],m[M]; for(i=0;i<M;i++) { sc2(t[i],m[i]); } mem(dp); for(i=0;i<M;i++) { for(j=T;j>=t[i];j--) { dp[j]=max(dp[j],dp[j-t[i]]+m[i]); } } cout<<dp[T]<<endl; }
标签:name sizeof scan lld namespace -- include eof const
原文地址:https://www.cnblogs.com/jackwang-sparrow/p/13365534.html