给3个数字, 求组成n 的方案中 数字个数最多的 ?
#include <iostream> #include<queue> #include <cstring> #define IOS std::ios::sync_with_stdio(0) using namespace std; const int N =1e5; int f[N],a[5],n; void solve(){ int i,j; cin>>n; for(i=1;i<=3;i++) cin>>a[i]; memset(f,-1,sizeof f); f[0]=0; for(i=1;i<=3;i++) for(j=a[i];j<=n;j++) if(f[j-a[i]]!=-1) f[j]=max(f[j-a[i]]+1,f[j]); cout<<f[n]; } signed main(){ IOS; solve(); }
标签:std,Cut,int,CodeForces,189A,include,Ribbon From: https://www.cnblogs.com/towboa/p/17150988.html