Arcadia Computing Contest 1 P1 - Test Anxiety

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

The end of the first semester is rapidly approaching! Ayman, who has been slacking off all semester, realizes he needs to lock in immediately. His main area of concern is AP English, and his goal is to obtain at least an 80\% overall average.

Ayman's teacher is a bit strange - she grades all assignments out of 100, and does not give extra credit. Furthermore, all assignments are worth the same amount. Ayman has one last assignment to complete before grades are finalized. Given his current average, determine the minimum integral score he must earn in order to end with a final grade of 80\% or higher.

If it is impossible for him to achieve this goal (poor him!), print -1.

Input Specification

The first line will contain Ayman's current average, an integer from 0 to 100.

The second line will contain the number of assignments he has currently completed, an integer from 1 to 1000.

Output Specification

Print the minimum integer score he must obtain to get at least an 80\% overall average.

Sample Input 1

79
2

Sample Output 1

82

Explanation for Sample 1

If Ayman earns a 82\%, his average will become \frac{(79\%+79\%+82\%)}{2+1}=\frac{240\%}{3}=80\%.

Sample Input 2

30
3

Sample Output 2

-1

Explanation for Sample 2

It can be proven that Ayman cannot obtain any score that will get him to 80\%.

Sample Input 3

99
103

Sample Output 3

0

Explanation for Sample 3

Ayman can flunk the last assignment and still obtain an 80\% average.


Comments

There are no comments at the moment.