100 atcoder#ABC104C. [ABC104C] All Green
[ABC104C] All Green
Score : points
Problem Statement
A programming competition site AtCode provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer between and (inclusive), there are problems with a score of points. These problems are all of the problems available on AtCode.
A user of AtCode has a value called total score. The total score of a user is the sum of the following two elements:
- Base score: the sum of the scores of all problems solved by the user.
- Perfect bonuses: when a user solves all problems with a score of points, he/she earns the perfect bonus of points, aside from the base score .
Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of or more points. At least how many problems does he need to solve for this objective?
Constraints
- All values in input are integers.
- and are all multiples of .
- It is possible to have a total score of or more points.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum number of problems that needs to be solved in order to have a total score of or more points. Note that this objective is always achievable (see Constraints).
2 700
3 500
5 800
3
In this case, there are three problems each with points and five problems each with points. The perfect bonus for solving all the -point problems is points, and the perfect bonus for solving all the -point problems is points. Takahashi's objective is to have a total score of points or more.
One way to achieve this objective is to solve four -point problems and earn a base score of points. However, if we solve three -point problems, we can earn the perfect bonus of points in addition to the base score of points, for a total score of points, and we can achieve the objective with fewer problems.
2 2000
3 500
5 800
7
This case is similar to Sample Input 1, but the Takahashi's objective this time is points or more. In this case, we inevitably need to solve all five -point problems, and by solving two -point problems additionally we have the total score of points.
2 400
3 500
5 800
2
This case is again similar to Sample Input 1, but the Takahashi's objective this time is points or more. In this case, we only need to solve two -point problems to achieve the objective.
5 25000
20 1000
40 1000
50 1000
30 1000
1 1000
66
There is only one -point problem, but the perfect bonus can be earned even in such a case.