Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 15134 Accepted Submission(s): 9117
完全背包、背包方案数的问题 一开始还以为n是以元为单位的.........
#include<bits/stdc++.h> using namespace std; long long int n,i,j,dp[35000]; int main() { while(cin>>n) { n=n; memset(dp,0,sizeof(dp)); dp[0]=1; for(i=1;i<=3;i++) { for(j=i;j<=n;j++) dp[j]+=dp[j-i]; } cout<<dp[n]<<endl; } }
原文:https://www.cnblogs.com/dyhaohaoxuexi/p/11437700.html