2803. Java Certification

单点时限: 10.0 sec

内存限制: 256 MB

You have just completed Java Certification exam that contained $n$ questions. You have a score card that explains your performance. The example of the scorecard is given below.

From this scorecard you can infer that the questions are broken down into m categories (in the above example $m = 6$). Each category contains $n_{i}$ questions ($1 \le n_{i} \le n$), so that $n_{1} + n_{2} + \cdots + n_{m} = n$. You know that you have correctly answered $k$ questions out of $n$ (in the above example $k = 78$ and $n = 87$), so you can easily find the number of incorrect answers $w = n - k$ (in the above example $w = 9$).

You do remember several questions that you were unsure about and you can guess what category they belong to. To figure out if your answers on those questions were right or wrong, you really want to know how many incorrect answers you have given in each category.

Let $w_{i}$ ($0 \le i \le n_{i}$) be the number of incorrect answers in $i$-th category, $w_{1} + w_{2} + \cdots + w_{m} = w$. From the scorecard you know the percentage of correct answers in each category. That is, for each $i$ from $1$ to $m$ you know the value of $100(n_{i} - w_{i}) / n_{i}$ rounded to the nearest integer. The value with a fractional part of $0.5$ is rounded to the nearest even integer.

It may not be possible to uniquely find the valid values for $w_{i}$. However, you guess that the questions are broken down into categories in a mostly uniform manner. You have to find the valid values of $w_{i}$ and $n_{i}$, so that to minimize the difference between the maximum value of $n_{i}$ and the minimum value of $n_{i}$. If there are still multiple possible values for $w_{i}$ and $n_{i}$, then find any of them.

输入格式

The first line of the input file contains three integer numbers — $k, n$, and $m$, where $k$ ($0 \le k \le n$) is the number of correctly answered questions, $n$ ($1 \le n \le 100$) is the total number of questions, $m$ ($1 \le m \le 10$) is the number of question categories. The following m lines of the input file contain one integer number from $0$ to $100$ (inclusive) on a line — percentages of the number of the correct answers in each category. The input file always corresponds to some valid set of $w_{i}$ and $n_{i}$.

输出格式

Write to the output file $m$ lines with two integer numbers $w_i$ and $n_i$ on a line, separated by a space — the number of incorrect answers and the total number of questions in each category, satisfying constraints as given in the problem statement.

样例

Input
78 87 6
100
100
83
92
75
93
Output
0 13
0 13
3 18
1 13
4 16
1 14

2 人解决,8 人已尝试。

6 份提交通过,共有 25 份提交。

9.5 EMB 奖励。

创建: 14 年,1 月前.

修改: 6 年,5 月前.

最后提交: 11 月,1 周前.

来源: Northeastern European Regional Contest 2009

题目标签