Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money. 
For example, if we have 11 cents, then we can make changes with one 10-cent coin and one 1-cent coin, or two 5-cent coins and one 1-cent coin, or one 5-cent coin and six 1-cent coins, or eleven 1-cent coins. So there are four ways of making changes for 11 cents with the above coins. Note that we count that there is one way of making change for zero cent. 
Write a program to find the total number of different ways of making changes for any amount of money in cents. Your program should be able to handle up to 100 coins. 

Input

The input file contains any number of lines, each one consisting of a number ( ≤250 ) for the amount of money in cents.

Output

For each input line, output a line containing the number of different ways of making changes with the above 5 types of coins.

Sample Input

11
26

Sample Output

4
13
 #include<stdio.h>
int main()
{
int n,m, a,b,c,d,e;
while(~scanf("%d", &n))
{
if(n)
{
m=;
for(a=;a<=;a++)
for(b=;b<=-*a;b++)
for(c=;c<=-*a-*b;c++)
for(d=;d<=-*a-*b-*c;d++)
for(e=;e<=-a-b-c-d;e++)
if(*a+*b+*c+*d+e==n)
{ m++; break; }
printf("%d\n", m);
}
else printf("1\n");
}
return ;
}
// 背包怎么做T^T

5F - Coin Change的更多相关文章

  1. [LeetCode] Coin Change 硬币找零

    You are given coins of different denominations and a total amount of money amount. Write a function ...

  2. HDOJ 2069 Coin Change(母函数)

    Coin Change Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  3. HDU 2069 Coin Change

    Coin Change Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total S ...

  4. UVA 674 Coin Change(dp)

    UVA 674  Coin Change  解题报告 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87730#problem/ ...

  5. JSU省赛队员选拔赛个人赛1(Coin Change、Fibbonacci Number、Max Num、单词数、无限的路、叠筐)

    JSU省赛队员选拔赛个人赛1 一.题目概述: A.Coin Change(暴力求解.动态规划)     B.Fibbonacci Number(递推求解) C.Max Num(排序.比较) D.单词数 ...

  6. C - Coin Change (III)(多重背包 二进制优化)

    C - Coin Change (III) Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu ...

  7. Coin Change (IV) (dfs)

    Coin Change (IV) Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu [Subm ...

  8. Coin Change (II)(完全背包)

                                                               Coin Change (II) Time Limit: 1000MS   Mem ...

  9. [LeetCode] Coin Change 2 硬币找零之二

    You are given coins of different denominations and a total amount of money. Write a function to comp ...

随机推荐

  1. http://sourceforge.net/projects/rtspdirectshow/

    如何做一个解析rtsp协议的h264压缩的实时视频流播放器,带保存功能,目前我有rtsp协议的h264压缩后的实时视频流,目前想开发一个客户端,来播放该实时视频流,同时保存为视频文件,目前似乎有方案是 ...

  2. EF 踩过的坑

    ef + mysql-8.0.12-winx64 这个版本的mysql,当一个类为树型结构,会迁移报错. 数据迁移提示:No connection string named 'TaoBaoEntiti ...

  3. java的Timer和TimerTask

    java中Timer类使用的方法是如下的: Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() ...

  4. SAP 使用

    SAP 提供多种方法查找系统内的事务代码 1. 使用SE11查看存储事物代码的表:TSTC 或者TSTCT TSTC: 存有事务代码,程序名称,屏幕号码等字段 TSTCT: 存有语言代码,事务代码,事 ...

  5. php zip扩展的一些基本操作

    public function zip_test() { $zip_obj = new ZipArchive(); $res = $zip_obj->open('/data1/www/www.k ...

  6. el-js中循环遍历el的集合

    遇到问题的代码: var score=0; for(var i=0;i<${fn:length(tMovie.tComments) };i++){ score=${tMovie.tComment ...

  7. HLSL

    [HLSL] 1.Direct3D 9 shaders can be designed using shader model 1, shader model 2 and shader model 3; ...

  8. Bootstrap 导航元素(标签页)

    [Bootstrap 导航元素] 1.基本的导航元素:标签导航.基于ul.li而来,给ul添加 class="nav nav-tabs" 即可.选中的li添加 class=&quo ...

  9. NBU 还原LINUX ORACLE RAC数据库(CRM)

    CRM集群数据库恢复 linux centos 6.6 oracle 11.2.0.3 集群环境 1.53 oraclea 1.54 oracleb 在linux操作系统root用户下安装好NBUci ...

  10. tabindex 去掉虚线

    参考 https://bbs.csdn.net/topics/390165247 style="outline: none"