LA 3288

From Algorithmist
Jump to navigation Jump to search

3288 - Harmonic Mean[edit]

Summary[edit]

Given of a sequence of several integers, compute their harmonic mean and print it in the form of a reduced fraction.

Explanation[edit]

This is the easiest problem of this contest. It was just required to write a program, doing the calculation described in the problem statement.

Notes[edit]

  • The output values may not fit in standard 32-bit integer type. The problem statement states that both the numerator and the denominator of the final answer fit into a 64-bit signed integer type. Thus, it is possible to use 64-bit integers throughout the computation – but be careful to check that your intermediate computations don't overflow.


Input[edit]

5
4 1 2 3 4
8 1 1 1 1 1 1 1 1
8 100 100 100 100 100 100 100 100
8 99 99 98 97 93 94 92 91
7 100 100 99 1 72 86 7

Output[edit]

Case 1: 48/25
Case 2: 1/1
Case 3: 100/1
Case 4: 6559696215072/68848064387
Case 5: 41718600/7142671