2669. Pi is Three

单点时限: 5.0 sec

内存限制: 256 MB

∏ (spelled pi in English) is a mathematical constant representing the circumference of a circle whose diameter is one unit length. The name ∏ is said to come from the first letter of the Greek words perif´ereia(meaning periphery) and per´imetro (perimeter).

Recently, the government of some country decided to allow use of 3, rather than 3.14, as the approximate value of ∏ in school (although the decision was eventually withdrawn probably due to the blame of many people). This decision is very surprising, since this approximation is far less accurate than those obtained before the common era.

Ancient mathematicians tried to approximate the value of ∏ without calculators. A typical method was to calculate the perimeter of inscribed and circumscribed regular polygons of the circle. For example,Archimedes (287–212 B.C.) proved that 223/71 < ∏ < 22/7 using 96-sided polygons, where 223/71 and 22/7 were both accurate to two fractional digits (3.14). The resultant approximation would be more accurate as the number of vertices of the regular polygons increased.

As you see in the previous paragraph, ∏ was approximated by fractions rather than decimal numbers in the older ages. In this problem, you are requested to represent ∏ as a fraction with the smallest possible denominator such that the representing value is not di erent by more than the given allowed error. If more than one fraction meets this criterion, the fraction giving better approximation is preferred.

输入格式

The input consists of multiple datasets. Each dataset has a real number R (0 < R <= 1) representing the allowed di erence between the fraction and ∏. The value may have up to seven digits after the decimal point. The input is terminated by a line containing 0.0, which must not be processed.

输出格式

For each dataset, output the fraction which meets the criteria in a line. The numerator and denominator of the fraction should be separated by a slash as shown in the sample output, and those numbers must be integers.

样例

Input
0.15
0.05
0.0
Output
3/1
19/6

21 人解决,25 人已尝试。

35 份提交通过,共有 99 份提交。

4.4 EMB 奖励。

创建: 14 年,7 月前.

修改: 6 年,8 月前.

最后提交: 3 年,5 月前.

来源: Japan

题目标签