#P17470. [ICPC 2018 Jiaozuo R] Resistors in Parallel

    ID: 19937 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>数学高精度2018ICPC

[ICPC 2018 Jiaozuo R] Resistors in Parallel

Problem Description

In this physics problem, what we are concerned about are only resistors. If you are poor at physics, do not worry, since solving this problem does not require you to have advanced abilities in physics.

Resistors are said to be connected together in parallel when both of their terminals are respectively connected to each terminal of the other resistors.

:::align{center} :::

We have the following parallel resistor equation for kk resistors with resistances R1,R2,⋯ ,RkR_1, R_2, \cdots, R_k in parallel and their combined resistance RR:

$$\displaystyle R = \frac{1}{\frac{1}{R_1} + \frac{1}{R_2} + \cdots + \frac{1}{R_k}}.$$

Now you have nn resistors, the ii-th of which has a resistance of rir_i ohms with the equation

$$\displaystyle r_i = \begin{cases} \infty & \text{if $i$ can be divided by $d^2$ for some integers $d\ge 2$,}\\ i & \text{otherwise.} \end{cases}$$

You also have nn selections, the ii-th of which is a set of resistors SiS_i such that

$$\displaystyle S_i = \{\text{the $j$-th resistor} \mid \text{$j$ is a divisor of $i$}\}.$$

Please find a selection in which the resistors form a parallel resistor with the minimum resistance and output the reduced fraction pq\frac{p}{q} of its resistance.

Input Format

The input contains several test cases, and the first line contains a positive integer TT indicating the number of test cases which is up to 100100.

For each test case, the only one line contains an integer nn, where 1≤n≤101001 \leq n \leq 10^{100}.

Output Format

For each test case, output a line containing a reduced fraction of the form p/q indicating the minimum possible resistance, where p and q should be positive numbers that are coprime.

3
10
100
1000
1/2
5/12
35/96