#include<string.h>
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    int dp[33001],x;
    memset(dp,0,sizeof(dp));
    dp[0]=1;
    for(int i=1;i<=3;i++)
    {
       for(int j=i;j<=33000;j++) dp[j]+=dp[j-i];//状态的联系便是他们的容量关系
    }
    while(cin>>x)
    {
        cout<<dp[x]<<endl;
    }
    return 0;
}
dp[j]表示在容量为j的情况下 满足情况的条件个数 由于每种硬币的个数可以无限使用 所以可以使用完全背包的思想去求解

相关文章:

  • 2021-05-10
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-06-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-15
相关资源
相似解决方案