P8840 [ChuanZhi Cup #4 Preliminary] Report Scoring
Description
At Chipmunk Tech University, the final assessment for the Computer Organization Principles lab is to submit a report.
However, as the course teacher, Teacher Luo does not want everyone to compete too hard, so the following rules are set:
Each report has a base score on the paper, denoted by $a$.
Based on this:
- If the report length is less than $16$ pages, $10$ points will be deducted. If the score becomes less than $0$, it will be recorded as $0$.
- If the report length exceeds $20$ pages, for each page over $20$, $1$ point will be deducted, until the score is reduced to $0$.
Now you know a report’s base score $a$ and its number of pages $p$. Please calculate the final score of this report. We guarantee that $1 \leq a \leq 100$ and $1 \leq p \leq 50$.
Input Format
This problem has multiple test cases.
The first line contains an integer $T$ $(1 \leq T \leq 1000)$, representing the number of test cases.
The next $T$ lines each contain two integers $a, p$, with the meaning as described above.
Output Format
Output a total of $T$ lines. Each line contains one integer, representing the final score for that query.
Explanation/Hint
Translated by ChatGPT 5