当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5742:It's All In The Mind

题目描述
Professor Zhang has a number sequence $a_1,a_2,...,a_n$. However, the sequence is not complete and some elements are missing. Fortunately, Professor Zhang remembers some properties of the sequence:

1. For every $i \in \{1,2,...,n\}$, $0 \le a_i \le 100$.
2. The sequence is non-increasing, i.e. $a_1 \ge a_2 \ge ... \ge a_n$.
3. The sum of all elements in the sequence is not zero.

Professor Zhang wants to know the maximum value of $\frac{a_1+a_2}{\sum_{i=1}^{n}{a_i}}$ among all the possible sequences.
输入解释
There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case:

The first contains two integers $n$ and $m$ $(2 \le n \le 100, 0 \le m \le n)$ -- the length of the sequence and the number of known elements.

In the next $m$ lines, each contains two integers $x_i$ and $y_i$ $(1 \le x_i \le n, 0 \le y_i \le 100, x_i < x_{i+1}, y_i \ge y_{i+1})$, indicating that $a_{x_i} = y_i$.
输出解释
For each test case, output the answer as an irreducible fraction "$p$/$q$", where $p$, $q$ are integers, $q > 0$.
输入样例
2
2 0
3 1
3 1
输出样例
1/1
200/201
来自杭电HDUOJ的附加信息
Author zimpha
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5742

最后修改于 2020-10-25T23:25:17+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)