P14920 [GESP202512 Level 6] Item Shop
Background
Corresponding multiple-choice and true/false questions:
Description
There are $n$ items to choose from in the item shop. The $i$-th item can increase the player's attack by $a_i$ points, and costs $c_i$ gold coins to buy. Each item can only be bought once. Now you have $k$ gold coins. How many attack points can you increase at most?
Input Format
The first line contains two positive integers $n,k$, the number of items and the number of gold coins you have.
In the next $n$ lines, each line contains two positive integers $a_i,c_i$, the number of attack points increased by the item and the number of gold coins needed to buy it.
Output Format
Output a single line with an integer, the maximum number of attack points that can be increased.
Explanation/Hint
For $60\%$ of the test data, it is guaranteed that $1\le k\le 500$ and $1\le c_i\le 500$.
For all the test data, it is guaranteed that $1\le n\le 500$, $1
\le k\le 10^9$, $1\le a_i\le 500$, and $1\le c_i\le 10^9$.
Translated by QwenWork