Square Coins

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Description

People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins, are available in Silverland. 
There are four combinations of coins to pay ten credits:

ten 1-credit coins, 
one 4-credit coin and six 1-credit coins, 
two 4-credit coins and two 1-credit coins, and 
one 9-credit coin and one 1-credit coin.

Your mission is to count the number of ways to pay a given amount using coins of Silverland.

Input

The input consists of lines each containing an integer meaning an amount to be paid, followed by a line containing a zero. You may assume that all the amounts are positive and less than 300. 

Output

For each of the given amount, one line containing a single integer representing the number of combinations of coins should be output. No other characters should appear in the output. 

Sample Input

2
10
30
0

Sample Output

1
4
27 dp[i]=dp[i-mon[i]]+dp[i]

hdu 1398 Square Coins 分钱币问题的更多相关文章

  1. 题解报告:hdu 1398 Square Coins(母函数或dp)

    Problem Description People in Silverland use square coins. Not only they have square shapes but also ...

  2. hdu 1398 Square Coins (母函数)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  3. hdu 1398 Square Coins(简单dp)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Pro ...

  4. hdu 1398 Square Coins(生成函数,完全背包)

    pid=1398">链接:hdu 1398 题意:有17种货币,面额分别为i*i(1<=i<=17),都为无限张. 给定一个值n(n<=300),求用上述货币能使价值 ...

  5. HDU 1398 Square Coins 整数拆分变形 母函数

    欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit ...

  6. 杭电ACM hdu 1398 Square Coins

    Problem Description People in Silverland use square coins. Not only they have square shapes but also ...

  7. HDU 1398 Square Coins(母函数或dp)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  8. HDU 1398 Square Coins(DP)

    Square Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  9. HDU 1398 Square Coins

    题目大意:有面值分别为.1,4,9,.......17^2的硬币无数多个.问你组成面值为n的钱的方法数. 最简单的母函数模板题: #include <cstdio> #include &l ...

随机推荐

  1. PL/SQL&存储过程||存储函数&触发器

    plsql 有点:交互式  非过程化   数据操纵能力强   自动导航语句简单   调试简单   想率高 声明类型的方式 1.基本类型 2.引用变量 3.记录型变量 基本格式 declare 声明 b ...

  2. kibana-Coordinate Map

    1. Visualize 添加图形 2. 选择图形类型  Coordinate Map 3. 选择索引 4. 设定成图的聚合字段 如果有数据,点击右上角的三角形,地图上就会有显示. 5. 保存图形

  3. 新博客:11101001.com

    开了一个新blog 但还是会用这个写博客 新博客地址11101001.com

  4. hdu 1506 Largest Rectangle in a Histogram 构造

    题目链接:HDU - 1506 A histogram is a polygon composed of a sequence of rectangles aligned at a common ba ...

  5. iOS duplicate symbol for architecture arm64 解决办法

    导致这个问题的原因有多种: 1.重复定义了const常量. 2.多个第三方库同时用到了某个函数库. 暂时列举这几种,以后遇到了其他原因再加.

  6. tcp 三次握手和四次断连深入分析:连接状态和socket API的关系----BAT 李运华

    http://blog.csdn.net/yunhua_lee/article/details/40513677 http://blog.csdn.net/yah99_wolf/article/cat ...

  7. 【XStream】xml和java实体的相互转化

    1.pom.xml <!-- xstream xml和Java对象转化 --> <dependency> <groupId>xstream</groupId& ...

  8. lock参数变化吗

    多线程应用中经常使用lock,在使用这个关键字的时候,经常有个疑问,如果更改了当时的入参,那么是否会变化呢,下面通过代码实例测试一把 class Program { static void Main( ...

  9. 快速搭建一个restful风格的springboot项目

    1.创建一个工程. 2.引入pom.xml依赖,如下 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi ...

  10. Java学习之自动装箱和自动拆箱源码分析

    自动装箱(boxing)和自动拆箱(unboxing) 首先了解下Java的四类八种基本数据类型   基本类型 占用空间(Byte) 表示范围 包装器类型 boolean 1/8 true|false ...