Minimum Final Exam Score
Time limit1sMemory limit256 MB
Given project, paper, and midterm scores, compute the smallest integer final score from 0 to 100 that lifts the weighted grade to 90, or report impossible.
- Level
Easy2 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
You are about to take the final exam for Basket Weaving 101, and you want to know the lowest score on that exam that still leaves you with a course grade of at least 90. The course grade is a weighted average of four parts. The project counts for 15%, the term paper for 20%, the midterm exam for 25%, and the final exam for 40%.
Given the project score, the term paper score, and the midterm exam score, find the smallest integer final exam score that brings the course grade to 90 or above. A final exam score is an integer from 0 to 100. If no score in that range reaches a course grade of 90, print impossible.
In other words, with a project score , a term paper score , a midterm score , and a final exam score , find the smallest integer that satisfies .
Input
The first line contains the number of test cases ().
Each of the next lines contains the project score, the term paper score, and the midterm exam score, in that order. Every score is an integer from 0 to 100.
Output
For each test case, print on its own line the smallest integer final exam score that gives a course grade of at least 90. If no score from 0 to 100 reaches a course grade of 90, print impossible on that line instead.