SAC '21 Code Challenge P4 - Averaging Averages
View as PDFTo get into university, you are required to have a high average, so your advisor offers you a challenge:
If you can answer my
queries, I will boost your average by
.
Each query will consist of , meaning your advisor wants you to query the average of courses 
 rounded down to the nearest integer.
Input Specification
The first line will contain  and 
, the number of courses you are currently taking and the number of queries.
The second line will contain  space-separated integers, 
, your average in the 
 course.
The next  lines will contain 
 and 
, a query for the average of your courses in 
.
Note: Fast I/O might be required to fully solve this problem (e.g., BufferedReader for Java).
Output Specification
Output  lines, the answer to each query rounded down to the nearest integer.
Constraints
For all subtasks:
Subtask 1 [50%]
Subtask 2 [50%]
No additional constraints.
Sample Input
5 3
100 50 0 75 90
1 2
2 3
2 5
Sample Output
75
25
53
Comments