2012年2月25日

USACO Superprime Rib

摘要: Butchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across them, one by one, by FJ and the USDA. Farmer John ensures that a purchaser of his prime ribs gets really prime ribs because when sliced from the right, the num 阅读全文

posted @ 2012-02-25 18:20 lzm风雨无阻 阅读(405) 评论(0) 推荐(0) 编辑

SWUST OJ Coin Changing

摘要: 设有n 种不同面值的硬币,各硬币的面值存于数组T[1:n]中。现要用这些面值的硬币来找钱。可以使用的各种面值的硬币个数存于数组Coins[1:n]中。 对于给定的1≤n≤10,硬币面值数组T和可以使用的各种面值的硬币个数数组Coins,以及钱数m,0≤m≤20001,编程计算找钱m的最少硬币数。Input第一行中只有1 个整数给出n的值,第2 行起每行2 个数,分别是T[j]和Coins[j]。最后1 行是要找的钱数m。Output最少硬币数,无解时输出-1Sample Input31 32 35 318Sample Output5#include <iostream> #incl 阅读全文

posted @ 2012-02-25 16:01 lzm风雨无阻 阅读(1258) 评论(0) 推荐(0) 编辑

POJ 3260 The Fewest Coins

摘要: Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 2677 Accepted: 796DescriptionFarmer 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 阅读全文

posted @ 2012-02-25 15:03 lzm风雨无阻 阅读(341) 评论(0) 推荐(0) 编辑

导航