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. DAX2012 R3安装

    安装程序跟DAX2009大同小异,不过这验证需要的组件也太多了,简直是.NET Framework大阅兵啊,各种版本都需要安装,特别是VC++从2008一直装到2012,有点崩溃... DEMO数据的 ...

  2. centos7.5下yum 安装mariadb数据库

    前言 mariadb 和mysql就像亲兄弟的关系,各种语法.驱动啥的,在mysql上能上的,在mariadb上基本都可以直接使用.更多的细节在此不多说. 1.删除旧版本 centos7下默认安装有m ...

  3. cdnbest的站点日志保存时间怎么设置

    站点的保存时间是以节点全局里的保存时间为准 站点的日志保存大小还不能设置

  4. 下载excel

    使用struts2的方式完成下载 对于下载excel2003,contentType如此设置 <result name="success" type="stream ...

  5. python--第三天总结

    [collection系列]1.计数器(counter) Counter是对字典类型的补充,用于追踪值的出现次数. ps:具备字典的所有功能 + 自己的功能 c = Counter('abcdeabc ...

  6. Android 性能测试之CPU

    接上一篇 CPU跟内存一样,存在一些测试子项,如下清单所示 1.空闲状态下的应用CPU消耗情况 2.中等规格状态下的应用CPU消耗情况 3.满规格状态下的应用CPU消耗情况 4.应用CPU峰值情况 C ...

  7. Cisco无线AP上联口为trunk时无法注册故障处理

    网络环境:WLC5520  AP:1832i-h-k9 客户实施过程中电话告知其将AP和交换机互联的端口类型设置为TRUNK口后,AP无法注册到WLC上,后经过查看配置发现客户用于AP管理的VLAN为 ...

  8. Codeforces Beta Round #57 (Div. 2)

    Codeforces Beta Round #57 (Div. 2) http://codeforces.com/contest/61 A #include<bits/stdc++.h> ...

  9. RockerMQ介绍 及搭建双master模式

    一.RocketMQ介绍 1.1 简介 RocketMQ 是一款分布式.队列模型的消息中间件,具有以下特点: 能够保证严格的消息顺序 提供丰富的消息拉取模式 高效的订阅者水平扩展能力 实时的消息订阅机 ...

  10. java虚拟机的原理

    所谓虚拟机,就是一台虚拟的机器.它是一款软件,用来执行一系列虚拟计算机指令,大体上虚拟机可以分为系统虚拟机和程序虚拟机,Visual Box .Vmare就属于系统虚拟机.他们完全是对物理计算机的仿真 ...