这道题算是一道很经典的题,很好的诠释了贪心和动态规划的不同功能。求最少钱的数量用贪心就够了,但是求最多钱的数量要用到动态规划的思想,每步都尽量保留最大数量。具体看程序注解:#include"iostream"#include"stdio.h"#include"algorithm"#include"s...
分类:
其他好文 时间:
2015-03-19 21:50:27
阅读次数:
138
http://poj.org/problem?id=1742
Description
People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony opened his money-box and found there were some coi...
分类:
其他好文 时间:
2015-03-18 21:48:46
阅读次数:
155
uva 147 Dollars
New Zealand currency consists of $100, $50, $20, $10, and $5 notes and $2, $1, 50c, 20c, 10c and 5c coins. Write a program that will determine, for any given amount, in how many...
分类:
其他好文 时间:
2015-03-15 15:19:22
阅读次数:
149
Square Coins
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8893 Accepted Submission(s): 6069
Problem Description
People in Silverl...
分类:
其他好文 时间:
2015-03-15 09:32:03
阅读次数:
124
Problem DescriptionWhuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some ...
分类:
其他好文 时间:
2015-03-14 16:45:55
阅读次数:
117
题意:给n张不同面值的钱,每种面值的钱都有一定数量,问用这些钱能够凑出多少种不同的面值,并且面值要在1~m内。输出种数。
思路:dp[i]表示i面值的钱是否能够凑出来(0或1)。...
分类:
其他好文 时间:
2015-03-14 12:32:48
阅读次数:
232
uva 674 Coin ChangeSuppose 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 cen...
分类:
其他好文 时间:
2015-03-11 19:43:09
阅读次数:
142
Square Coins
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8891 Accepted Submission(s): 6067
Problem Description
People in Sil...
分类:
其他好文 时间:
2015-03-11 14:54:01
阅读次数:
140
#include#include#include#include#includeusing namespace std;int a[120],c[120];int dp[100000+100];int main(){ int n,m; int i,j,k; while(scanf("%d%d"...
分类:
其他好文 时间:
2015-03-10 22:47:50
阅读次数:
166
Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,...
分类:
其他好文 时间:
2015-03-06 11:24:03
阅读次数:
142