Problems > The Final Exam

The Final Exam

Difficulty: 1000 2000 ms 128 MB

math

Your first N−1 scores are given; scores are integers in [0, 100]. Print the minimum final-exam score so the average of all N scores is at least T, or IMPOSSIBLE if even 100 is not enough.

Input: the first line has N and T; the second line has the N−1 existing scores.

Output: the minimum required score (possibly 0), or IMPOSSIBLE.

Constraints:

  • 2 ≤ N ≤ 104
  • 0 ≤ T ≤ 100

Sample Tests

Input 1
3 90
85 88
Output 1
97
Input 2
2 100
99
Output 2
IMPOSSIBLE

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.