FJ 准备买一些新奶牛。市场上有 头奶牛,第 头奶牛价格为 。FJ 有 张优惠券,使用优惠券购买第 头奶牛时价格会降为 ,当然每头奶牛只能使用一次优惠券。FJ 想知道花不超过 的钱最多可以买多少奶牛?
coupons.in
* Line 1: Three space-separated integers: N, K, and M.
* Lines 2..N+1: Line i+1 contains two integers: P_i and C_i.
coupons.out
* Line 1: A single integer, the maximum number of cows FJ can afford.
4 1 7 3 2 2 2 8 1 4 3
3
FJ has 4 cows, 1 coupon, and a budget of 7.
FJ uses the coupon on cow 3 and buys cows 1, 2, and 3, for a total cost of 3 + 2 + 1 = 6.