QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#7033. 并联电阻

Statistics

在这个物理问题中,我们只关心电阻。如果你物理不好,不用担心,因为解决这个问题不需要你具备高深的物理知识。

当电阻的两个端点分别连接到其他电阻的对应端点时,称这些电阻并联。

对于 $k$ 个电阻 $R_1, R_2, \dots, R_k$ 并联,其总电阻 $R$ 的计算公式如下:

$$R = \frac{1}{\frac{1}{R_1} + \frac{1}{R_2} + \dots + \frac{1}{R_k}}$$

现在你有 $n$ 个电阻,其中第 $i$ 个电阻的阻值 $r_i$(单位为欧姆)由以下公式给出:

$$r_i = \begin{cases} \infty & \text{如果 } i \text{ 能被某个整数 } d \ge 2 \text{ 的平方 } d^2 \text{ 整除} \\ i & \text{其他情况} \end{cases}$$

你还有 $n$ 种选择,其中第 $i$ 种选择是一个电阻集合 $S_i$,满足:

$$S_i = \{ \text{第 } j \text{ 个电阻} \mid j \text{ 是 } i \text{ 的约数} \}$$

请找到一种选择,使得其中的电阻并联后总电阻最小,并输出其总电阻的最简分数形式 $p/q$。

输入格式

输入包含多个测试用例。第一行包含一个正整数 $T$,表示测试用例的数量,最多为 $100$。

对于每个测试用例,仅有一行包含一个整数 $n$,其中 $1 \le n \le 10^{100}$。

输出格式

对于每个测试用例,输出一行,包含一个形如 $p/q$ 的最简分数,表示最小可能的电阻值,其中 $p$ 和 $q$ 应为互质的正整数。

样例

输入 1

3
10
100
1000

输出 1

1/2
5/12
35/96

Figure 1. 并联电阻示意图

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.