GlobeX Cup '18 S2 - Test Scores
View as PDFAt the start of the semester, your teacher hands you a course outline. The outline states that there will be  tests, each of which will be out of 
 marks.
Your school has a weird scoring system. Instead of using percentages or letter grades, your school simply provides the average of your test scores on your report card.
You would like your parents to see a mark that is higher than or equal to  on your report card.
As of right now, you have predicted that for each test  
 that will happen, you will score 
 if you do not study at all. From there, you can increase your mark by 
 point for every 
 hours you study.
Find out the minimum total number of hours you need to study for all tests. Note that each test is weighted the same.
Input Specification
Line  contains integers 
, 
, and 
, separated by a space. 
 is the number of tests throughout the semester. 
 is the number of marks that each test is scored out of. 
 is the minimum mark that you will accept on your report card.
Lines  to 
: The 
 line contains the integers 
 and 
, separated by a space, where 
. 
 is the predicted score on test 
 if you do not study at all. 
 is the number of hours you need to study to increase your score by 
 on that test.
Output Specification
Output the minimum number of hours you need to study to get a mark of at least  on your report card.
Constraints
Subtasks
Subtask 1 [10%]
Subtask 2 [30%]
Subtask 3 [60%]
No additional constraints.
Sample Input
5 7 6
5 3
6 4
7 1
1 5
3 3
Sample Output
27
Sample Explanation
You can increase your score on the first test up to 7 by studying for 6 hours. You can then increase your score on the second test by 1 point with 4 hours of studying. You can increase your score on the fourth test by 1 point with 5 hours of studying. Finally, increase your score on the last test up to 7 by studying for 12 hours.
Note that you cannot increase your score on any test to have a value of greater than 7 as the tests are out of 7 marks.
Comments