当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1398:Square Coins

题目描述
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.
输入解释
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.
输出解释
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.
输入样例
2
10
30
0
输出样例
1
4
27
来自杭电HDUOJ的附加信息
Recommend Ignatius.L

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-1398

最后修改于 2020-10-25T22:44:36+00:00 由爬虫自动更新

共提交 164

通过率 67.07%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)