QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 512 MB Points totaux : 100

#2355. 圆周率近似值

Statistiques

Vasya 有一个机器人,它可以计算出从给定的一组木棍中可以构成的不同直角三角形的数量:我们可以取三根木棍并将它们用作三角形的三条边。不幸的是,该机器人只能区分三角形的角度,而无法区分其边长。因此,机器人的计算假设相似的三角形是相等的。如果一个三角形可以通过均匀缩放、平移、旋转和反射得到另一个三角形,则称这两个三角形相似。

Vasya 的朋友 Petya 发现了一个惊人的事实。如果给机器人 $n$ 根长度分别为 $1$ 到 $n$ 的整数长度的木棍,并将机器人计算出的结果除以 $n$,我们得到的数值是无理数 $\frac{1}{2\pi}$ 的一个良好近似。

Vasya 使用了 Petya 提出的想法,对从 $n_{\min}$ 到 $n_{\max}$ 的所有整数 $n$ 进行了计算,并记录了结果。时光流逝,Vasya 丢失了实验结果,而他的机器人也坏了。请帮助他再次找到如果使用该想法对从 $n_{\min}$ 到 $n_{\max}$ 的所有整数 $n$ 进行计算所能得到的 $\pi$ 的最佳近似值。在这里,如果 $| \pi - x | < | \pi - y |$,则称 $x$ 比 $y$ 更接近 $\pi$。

输入格式

第一行包含一个整数 $t$,表示测试用例的数量 ($1 \le t \le 100$)。接下来的 $t$ 行包含测试用例,每行一个。每个测试用例由两个整数 $n_{\min}$ 和 $n_{\max}$ 表示 ($5 \le n_{\min} \le n_{\max} \le 200\,000\,000$,$n_{\max} - n_{\min} < 100$)。

输出格式

对于每个测试用例,输出一行包含一个最简分数,它是使用 Petya 的想法所能找到的 $\pi$ 的最佳近似值。分子、除号和分母之间用空格隔开。

样例

输入 1

5
5 6
5 13
14 17
91 100
99999901 100000000

输出 1

3 / 1
13 / 4
17 / 6
47 / 15
99999967 / 31830978

说明

在第三个测试用例中,在四个近似值 $\{ \frac{7}{2}, \frac{15}{4}, 4, \frac{17}{6} \}$ 中,分数 $\frac{17}{6}$ 是最好的一个,因为它的值最接近 $\pi$。

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.