#Lutece0552. Cow Coupons
Cow Coupons
Migrated from Lutece 552 Cow Coupons
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Farmer John needs new cows! There are cows for sale (), and FJ has to spend no more than his budget of units of money (). Cow costs money (), but FJ has coupons (), and when he uses a coupon on cow , the cow costs instead (). FJ can only use one coupon per cow, of course.
Input
- Line : Three space-separated integers: , , and .
- Lines : Line contains two integers: and .
Output
- Line : A single integer, the maximum number of cows FJ can afford.
Samples
4 1 7
3 2
2 2
8 1
4 3
3
Note
FJ uses the coupon on cow and buys cows , , and , for a total cost of .
Resources
USACO Feb 2012