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. 关于池化(pooling)理解!!!

    网上看到一个池化的解释是: 为了描述大的图像,可以对不同位置的特征进行聚合统计,如计算平均值或者是最大值,即mean-pooling和max-pooling 我的想法是,图像做卷积以后,将图像信息(特 ...

  2. Python基础学习Day4 列表的使用方法、range 用法、in用法

    一.列表 1.1列表:python基础数据类型之一:其他语言也有列表的概念,js 数组,可索引 ,可切片,可加步长 1.2列表的索引,切片,切片+ 步长 结果: 注意:列表里元素的数据类型,就是它本身 ...

  3. 面试真题--------spring源码解析AOP

    接着上一章对IOC的理解之后,再看看AOP的底层是如何工作的. 1.实现AOP的过程    首先我们要明白,Spring中实现AOP,就是生成一个代理,然后在使用的时候调用代理. 1.1 创建代理工厂 ...

  4. Activty左出右进动画

    [Activty左出右进动画] public void overridePendingTransition (int enterAnim, int exitAnim) 其中: enterAnim 定义 ...

  5. 签名Cookie

    [签名Cookie] set-cookie时加上防篡改验证码. 如: user_name=alex|bj95ef23cc6daecc475de   防篡改验证码的生成规则可以很简单:md5(cooki ...

  6. 第五篇:jmeter图形监控扩展

    插件下载:http://jmeter-plugins.org/downloads/all/ 插件: 1.首先将jmeterPluging.jar包复制到jmeter的lib目录下面的ext目录下面,然 ...

  7. uwsgi+nginx+django生产环境部署

    1.升级python到2.7版本 2.安装uwsgi 出现uwsgi未找到 yum groupinstall "Development tools"yum install zlib ...

  8. springboot logback

    /resources/logback-spring.xml <configuration> <appender name="stdout" class=" ...

  9. 已知一个函数rand7()能够生成1-7的随机数,请给出一个函数rand10(),该函数能够生成1-10的随机数。

    题目: 已知一个函数rand7()能够生成1-7的随机数,请给出一个函数,该函数能够生成1-10的随机数. 思路: 假如已知一个函数能够生成1-49的随机数,那么如何以此生成1-10的随机数呢? 解法 ...

  10. Hudson 打包部署到Was上特别慢

    一.找问题点 1.打包很快,到部署很慢 2.部署到其他was一样很慢 二.解决 经过寻找,网上找出以下一段话: 问题出在web.xml,web.xml中的版本信息不对,要根据你的servlet版本和运 ...