| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2070 人关注过本帖
标题:[讨论]出个题吧,DP...
取消只看楼主 加入收藏
Eastsun
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:802
专家分:0
注 册:2006-12-14
收藏
 问题点数:0 回复次数:5 
[讨论]出个题吧,DP...
典型的DP题
http://acm.hdu.edu.cn/showproblem.php?pid=2069


Problem Description
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 cents.

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

搜索更多相关主题的帖子: class blank example amount target 
2007-09-04 13:13
Eastsun
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:802
专家分:0
注 册:2006-12-14
收藏
得分:0 

让我很迷惑的是这句话
Your program should be able to handle up to 100 cents.

我觉得是"你的程序应该能够处理100美分内的情形"的意思

不过WA了N此后,发现似乎这句话的意思应该"你的程序应该处理硬币总数在100内的情形"

不过本人英语很烂,所以不排除是我的代码歪打正着的因素...


My BlogClick Me
2007-09-04 13:20
Eastsun
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:802
专家分:0
注 册:2006-12-14
收藏
得分:0 
呵呵,做出来就把AC的截图贴出来吧

My BlogClick Me
2007-09-04 13:28
Eastsun
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:802
专家分:0
注 册:2006-12-14
收藏
得分:0 
有点水,其实我就是想知道那句英语是怎么翻译的....

另外,如果雨中飞燕 把那个题目中的 <=250限制改到 <=10000出个题估计会好一点.

My BlogClick Me
2007-09-04 18:13
Eastsun
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:802
专家分:0
注 册:2006-12-14
收藏
得分:0 
太水没人做了?

My BlogClick Me
2007-09-05 17:35
Eastsun
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:32
帖 子:802
专家分:0
注 册:2006-12-14
收藏
得分:0 
DP丫.
不过注意的是题目的要求:只考虑硬币总数在100内情形.
http://groups.csdn.net/Algorithms
这里有我写的代码.

My BlogClick Me
2007-09-05 19:10
快速回复:[讨论]出个题吧,DP...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018208 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved