http://poj.org/problem?id=3040 FJ 有n种不同面值的硬币,每种硬币都有相应的个数,大面值的硬币值总能被小面值的硬币值整除,每周需要支付 Bessie c元,问最多能支付Bessie多少周. 这题之所以能贪心,据说关键是这句话 where each denomination of coin evenly divides the next-larger denomination. 如果没有这个限制条件,有些情况是取不到最优解的. 把面值从小到大排序,然后从尾到头开…
一.题目 Description As a reward for record milk production, Farmer John has decided to start paying Bessie the cow a small weekly allowance. FJ has a set of coins in N (1 <= N <= 20) different denominations, where each denomination of coin evenly divid…
Allowance Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1540 Accepted: 637 Description As a reward for record milk production, Farmer John has decided to start paying Bessie the cow a small weekly allowance. FJ has a set of coins in…