#1034. 「USACO 2012.2 Gold」Cow Coupons

内存限制
512 MiB
时间限制
2000 ms
文件输入输出
coupons.in ≫ coupons.out
题目类型
传统
评测方式
文本比较
上传者 admin
题目来源 usaco

显示标签

题目描述

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.

样例

输入 #1

4 1 7 
3 2 
2 2 
8 1 
4 3

输出 #1

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.