P9740 "KDOI-06-J" ION Contest
Description
In the ION Contest, there are a total of $n$ problems. The full score for each problem is $100$ points.
Problem $i$ has $a_i$ test points, and all test points in this problem have the same value, so $a_i$ must be a divisor of $100$. For each test point you pass, you will get the score equal to the value of that test point.
By some technical means, you learned that this year's Au cutoff score in the ION Contest is $t$ points.
Now, in problem $i$, you have already passed $b_i$ test points. As a strategic contestant, you want to know: for any $1\le j\le n$, if you spend all the remaining contest time grinding only problem $j$ (and do no other problems), what is the minimum number of additional test points you need to pass to get Au, that is, to make your total score $\ge t$.
Of course, you may be unable to turn the tables (get Au) by grinding a certain problem. In that case, you need to output `NaN`.
Input Format
Read input from standard input.
The first line contains a positive integer $n$, representing the total number of problems.
The next $n$ lines each contain two non-negative integers $a_i, b_i$, representing the number of test points in problem $i$ and the number of test points you have already passed. It is guaranteed that $a_i$ is a divisor of $100$ and $b_i \le a_i$.
The last line contains an integer $t$, representing the Au cutoff score.
Output Format
Write output to standard output.
If your score has already reached the Au cutoff, output one line with the string `Already Au.`.
Otherwise, output $n$ lines. In line $i$, output one of the following two formats:
+ A positive integer $c_i$, meaning the minimum number of additional test points you need to pass in problem $i$ to get Au.
+ The string `NaN`, meaning you cannot turn the tables (get Au) through this problem.
Explanation/Hint
**[Sample Explanation #1]**
It is easy to see that the current score is $100+100+92+40+70+44=446$, and the cutoff score is $447$. Therefore, in any problem where you have not gotten full marks, passing one more test point is enough.
**[Constraints]**
For all testdata, it is guaranteed that: $1\leq n\leq 7$, $0\leq b_i\leq a_i$, $1\leq a_i\leq 100$ and $a_i$ is a divisor of $100$, $0\leq t\leq 100n$.
| Test Point ID | $n$ | $a_i$ | Special Property |
| :----------: | :----------: | :----------: | :----------: |
| $1$ | $\leq7$ | $\leq100$ | Guarantees that the current score is greater than or equal to $t$ |
| $2\sim3$ | $=1$ | $\leq100$ | None |
| $4\sim5$ | $\leq7$ | $=100$ | None |
| $6\sim10$ | $\leq7$ | $\leq100$ | None |
Translated by ChatGPT 5