http://acm.jlu.edu.cn/joj/showproblem.php?pid=1424

 

#include <stdio.h>
#include <string.h>

const int coins[6]={0,1,5,10,25,50};

int f[7500];

inline void CompletePack(int w,int total)
{
    for(int j = 1; j <= total; j++)
    {
        if(j >= w) f[j] += f[j-w];
  //      printf("%d ",f[j]);
    }
  //  printf("\n");
}

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int i;
        memset(f,0,sizeof(f));
        f[0] = 1;
        for(i=1; i <= 5; i++) CompletePack(coins[i],n);
        printf("%d\n",f[n]);
    }
    return 0;
}

相关文章:

  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2021-06-17
  • 2021-07-14
  • 2021-06-14
  • 2021-12-28
  • 2021-05-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案