TLE '17 Contest 4 P1 - Riding the Curve

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
A beauty in mathematics.

You have just recently written a mathematics exam. Your professor, Prof. Snew, is very nice and likes to adjust the marks so that his students' grades are higher.

The exam is initially out of M marks. Prof. Snew does the following to calculate a student's new mark:

Suppose the raw mark is X. Then, add K marks to the raw mark, and make the exam out of N marks. That is, the final mark is \frac{X+K}{N}.

You now wonder to yourself, what is the minimum raw exam mark required to pass (at least 59.5\%) after adjustment?

Input Specification

The first line of input will contain three integers, M (1 \le M \le 1\,000), K (-1\,000 \le K \le 1\,000), and N (1 \le N \le 1\,000).

Output Specification

Output a single integer between 0 and M, the minimum raw exam mark required to pass. If it is impossible to pass, output have mercy snew instead.

Sample Input

50 32 80

Sample Output

16

Comments


  • 0
    DOUi  commented on Sept. 5, 2022, 3:43 p.m.

    If you are getting WA, remember that floating point errors exist