题目大意:
去买可乐,一瓶可乐8元。有1元、5元和10元三种货币,初始分别拥有数量给定。自动售货机会用最少的硬币数量找零。找零的钱可以继续使用。问最少向售货机中投入多少枚硬币,能买到C瓶可乐。
解题思路:
货币数量较少,状态不多。只有付10*1找1*2(投入1枚)、付5*1+1*3找0(投入4枚)、付10*1+1*3找5*1(投入4枚)、付1*8找0(投入8枚)这四种情况,可以想到其他的方法,投入的硬币数量肯定更多,所以不用考虑。
动态规划。只需记录三种面值的数量所为状态即可。用dp[n1][n5][n1...
分类:
其他好文 时间:
2014-11-20 12:10:12
阅读次数:
217
uva 10626 Buying Coke (DP + 记忆化搜索) —— black的专栏 —— waShaXiu...
分类:
其他好文 时间:
2014-11-14 15:45:27
阅读次数:
135
Description约翰的干草库存已经告罄,他打算为奶牛们采购日(1≤日≤50000)磅干草.他知道N(1≤N≤100)个干草公司,现在用1到N给它们编号.第i个公司卖的干草包重量为Pi(1≤Pi≤5000)磅,需要的开销为Ci(l≤Ci≤5000)美元.每个干草公司的货源都十分充足,可以卖出无限...
分类:
其他好文 时间:
2014-10-29 00:00:55
阅读次数:
404
Description
You've recently started an ice-cream business in a local school. During a day you have many suppliers delivering the ice-cream for you, and many students buying it from you. You are...
分类:
其他好文 时间:
2014-10-20 00:53:04
阅读次数:
258
Finance knowledgeTrading---At the core of our business model is Trading, which involves the buying and selling of financial tools to generate profit. ...
分类:
其他好文 时间:
2014-10-01 22:36:01
阅读次数:
369
1618: [Usaco2008 Nov]Buying Hay 购买干草Time Limit:5 SecMemory Limit:64 MBSubmit:641Solved:328[Submit][Status]Description约翰的干草库存已经告罄,他打算为奶牛们采购日(1≤日≤50000)...
分类:
其他好文 时间:
2014-08-28 14:32:09
阅读次数:
172
题目:uva10626 - Buying Coke(记忆话搜索)
题目大意:给你3种价值的硬币, 1, 5, 10现在要求你取自动售卖机买可乐,一瓶可乐价值8,给你要求买的可乐的数目,和三种硬币的数目,问你最少需要投多少硬币。自动售卖机会根据你投入的钱来找零,可以的话找出的零钱硬币会最少。
解题思路: 这题之前没有想到可乐的已经购买瓶数是隐含在剩余的硬币情况中,换句话说就是你买...
分类:
其他好文 时间:
2014-08-22 22:36:14
阅读次数:
220
1.客户几个关系表ER图
Party
Anentity that can enter into a business relationship, such as buying and selling,and can be of the type Organization or Person.
Party指的能够进行业务往来的实体,例如能够进行采购和销售动作,类型可...
分类:
其他好文 时间:
2014-08-16 21:07:21
阅读次数:
231
Besides bags brands and high quality products with high strength, which takes lata.Materia bonus? look and feel rich. Before buying handbags for women...
分类:
其他好文 时间:
2014-07-16 14:58:21
阅读次数:
407
BUYING FEED
时间限制:3000 ms | 内存限制:65535 KB
难度:4
描述
Farmer John needs to travel to town to pick up K (1 D*K cents.
The county feed lot has N (1 location X_i (0 <
X_i John as much as F_i (1
A...
分类:
其他好文 时间:
2014-07-12 20:27:31
阅读次数:
263