HDU:2069 Coin Change
来源:互联网 发布:怎样退出淘宝客推广 编辑:程序博客网 时间:2024/04/29 15:44
Coin Change
Time Limit:1000/1000 MS(Java/Others)Total Submission(s):2461
For example, if we have 11 cents, then we can make changes with one10-cent coin and one 1-cent coin, or two 5-cent coins and one1-cent coin, or one 5-cent coin and six 1-cent coins, or eleven1-cent coins. So there are four ways of making changes for 11 centswith the above coins. Note that we count that there is one way ofmaking change for zero cent.
Write a program to find the total number of different ways ofmaking changes for any amount of money in cents. Your program should be able to handle up to 100cents.
1126
413
浙江工业大学网络选拔赛
solution:
#include<stdio.h>
int main()
{
}
//以上使用生成函数做的,但是WRONG,原因在于出题者将红色部分错误表达为硬币总数不能超过100块
这样的话,我们就可以使用暴力解法,例如百钱买百鳮的问题
解法如下:
#include<stdio.h>
int main()
{
}
优化下:
#include<stdio.h>
int main()
{
}
再优化下:
#include<stdio.h>
int main()
{
}
目前水平只能优化到此,下面使用更暴力的办法,0ms
#include<stdio.h>
int main()
{
}
- HDU:2069 Coin Change
- HDOJ 2069 Coin Change
- HDU 2069 Coin Change
- hdu 2069 Coin Change
- HDU 2069 Coin Change
- HDU 2069 Coin Change
- hdu 2069 Coin Change
- HDU 2069 Coin Change
- hdu 2069 Coin Change
- hdu 2069 Coin Change
- hdu-2069-Coin Change
- HDU 2069 Coin Change
- hdu---2069Coin Change
- HDU 2069 Coin Change
- HDU 2069 Coin Change
- HDU-2069-Coin Change
- hdu 2069 Coin Change
- HDU#2069: Coin Change
- HDU:2604 Queuing(发现似乎所有…
- ACM(Association for Computing Ma…
- 如何判断一个数是否为素数
- 世界24大视觉奇图:智商低的…
- POJ水题
- HDU:2069 Coin Change
- 哈哈,崔姓的来源!家谱网竟然还有…
- ZZULI 1480 图论的起源
- HDU:1063 POJ:1001 Exponentiat…
- 浙江大学获ACM-ICPC World Finals …
- Unity-水面效果的shader文件
- HDU:1073 Online Judge
- HDU:1124 Factorial
- 并查集 (先转了!)