Problem AD
Financial Planning
Being a responsible young adult, you have decided to start
planning for retirement. Doing some back-of-the-envelope
calculations, you figured out you need at least
You are currently broke, but fortunately a generous gazillionaire friend has offered to lend you an arbitrary amount of money (as much as you need), without interest, to invest in the stock market. After making some profit you will then return the original sum to your friend, leaving you with the remainder.
Available to you are
For example, consider the first sample. If you buy only the
second investment (which costs
Input
-
The first line contains the number of investment options
and the minimum amount of money you need to retire . -
Then,
lines follow. Each line has two integers: the daily profit of this investment and its initial cost .
Output
Print the minimum number of days needed to recoup your
investments and retire with at least
Sample Input 1 | Sample Output 1 |
---|---|
2 5 4 10 10 15 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
4 10 1 8 3 12 4 17 10 100 |
6 |
Sample Input 3 | Sample Output 3 |
---|---|
3 5 4 1 9 10 6 3 |
1 |