POJ3260The Fewest Coins题解动态规划DP
来源:互联网 发布:外国人 汉字 知乎 编辑:程序博客网 时间:2024/06/16 02:25
Description
Farmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a way that the smallest number of coins changes hands, i.e., the number of coins he uses to pay plus the number of coins he receives in change is minimized. Help him to determine what this minimum number is.
FJ wants to buy T (1 ≤ T ≤ 10,000) cents of supplies. The currency system has N (1 ≤ N ≤ 100) different coins, with values V1, V2, ..., VN (1 ≤ Vi ≤ 120). Farmer John is carrying C1 coins of value V1, C2 coins of value V2, ...., and CN coins of value VN (0 ≤ Ci ≤ 10,000). The shopkeeper has an unlimited supply of all the coins, and always makes change in the most efficient manner (although Farmer John must be sure to pay in a way that makes it possible to make the correct change).
Input
Line 2: N space-separated integers, respectively V1, V2, ..., VN coins (V1, ...VN)
Line 3: N space-separated integers, respectively C1, C2, ..., CN
Output
Sample Input
3 705 25 505 2 1
Sample Output
3
Hint
Source
- POJ3260The Fewest Coins题解动态规划DP
- TOJ 1662 The Fewest Coins -- 动态规划DP
- POJ 3260 The Fewest Coins(动态规划+多重背包+完全背包)
- POJ 3260The Fewest Coins (DP)
- 【DP】 POJ 3260 The Fewest Coins 背包
- Bookshelf题解动态规划DP
- POJ2353Ministry题解动态规划DP
- POJ1260Pearls题解动态规划DP
- HDU2845Beans题解动态规划DP
- POJ3356AGTC题解动态规划DP
- POJ1745Divisibility题解动态规划DP
- HDU3449Consumer题解动态规划DP
- POJ2626Chess题解动态规划DP
- POJ1837Balance题解动态规划DP
- POJ3661Running题解动态规划DP
- POJ2229Sumsets题解动态规划DP
- POJ1036Gangsters题解动态规划DP
- POJ3073Spam题解动态规划DP
- CCNA交换版TOPOLOGY&NET
- EasyMock与Junit的集成测试
- 多线程:Thread类的Join()方法
- 在keil中编译ucos时要注意的问题
- Managed Code and Native Code
- POJ3260The Fewest Coins题解动态规划DP
- Section 1.4 Mother's Milk
- c++对象模型 内存布局
- C语言可变参数
- 位运算之美——用+,-和位运算实现正整数除法和取模(一)
- c++指针的使用总结——开始菜鸟之路!
- 摄像头接线 SM9C120A 1605
- winio 模拟按键(无PS2键盘,未测试)
- C++中 Static作用和使用方法(改正)