P29285 [洛谷] "KDOI-06-J" ION Competition
普及-
题目描述

Problem Description

In the ION Competition, there are a total of $n$ problems. Each problem is worth a maximum of 100 points.

The $i$-th problem has $a_i$ test cases, and all test cases for this problem have equal scores, so $a_i$ must be a divisor of 100. Each test case passed will earn you points equal to its score.

Through some technical means, you have learned that the gold cut-off score for this year's ION Competition is $t$ points.

Currently, you have passed $b_i$ test cases for the $i$-th problem. As a strategic competitor, you want to know: for any $1 \leq j \leq n$, if you focus solely on the $j$-th problem (not doing any other problems) for the remaining time in the competition, how many more test cases do you need to pass to achieve gold, i.e., to have a total score $\geq t$.

Of course, it is possible that you cannot achieve gold by focusing solely on any single problem, in which case you should output NaN.

Input Format

Input is read from the 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$ and $b_i$, representing the number of test cases for the $i$-th problem and the number of test cases you have already passed, respectively. It is guaranteed that $a_i$ is a divisor of 100 and $b_i \leq a_i$.

The last line contains an integer $t$, representing the gold cut-off score.

Output Format

Output is written to the standard output.

If your score has already reached the gold cut-off, output a single line with the string Already Au..

Otherwise, output $n$ lines. On the $i$-th line, you should output one of the following two formats:

  • A positive integer $c_i$, indicating the minimum number of additional test cases you need to pass in the $i$-th problem to achieve gold.
  • A string NaN, indicating that you cannot achieve gold by focusing solely on this problem.

Sample Input and Output

Sample Input #1

7
100 100
20 20
25 23
25 10
20 14
25 11
20 0
447

Sample Output #1

NaN
NaN
1
1
1
1
1

Sample Input #2

7
100 100
20 20
25 23
25 10
20 14
25 11
20 0
446

Sample Output #2

Already Au.

Sample Input #3

7
100 100
20 20
20 10
25 13
20 20
25 16
20 6
509

Sample Output #3

NaN
NaN
3
4
NaN
4
3

Sample Input #4

7
100 100
20 19
20 20
25 11
20 20
25 25
20 6
509

Sample Output #4

Already Au.

Notes

[Sample Explanation #1]

It is easy to find that the current score is $100 + 100 + 92 + 40 + 70 + 44 = 446$, and the cut-off score is $447$, so passing one more test case in any problem that is not fully scored will suffice.

[Data Range]

For all data, 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 Case Number $n$ $a_i$ Special Conditions
1 $\leq 7$ $\leq 100$ Guaranteed current score $\geq t$
2-3 $= 1$ $\leq 100$ None
4-5 $\leq 7$ $= 100$ None
6-10 $\leq 7$ $\leq 100$ None
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7 100 100 20 20 25 23 25 10 20 14 25 11 20 0 447
样例输出
NaN NaN 1 1 1 1 1