F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

It's All In The Mind

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 3444    Accepted Submission(s): 1367


Problem Description
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.
 

Input
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$.
 

Output
For each test case, output the answer as an irreducible fraction "$p$/$q$", where $p$, $q$ are integers, $q > 0$.
 

Sample Input
2 2 0 3 1 3 1
 

Sample Output
1/1 200/201
 

Author
zimpha
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 03:42:16, Gzip enabled