
ZOJ Problem Set  1601
The FORTH programming language does not support floatingpoint arithmetic at all. Its author, Chuck Moore, maintains that floatingpoint calculations are too slow and most of the time can be emulated by integers with proper scaling. For example, to calculate the area of the circle with the radius R he suggests to use formula like R * R * 355 / 113, which is in fact surprisingly accurate. The value of 355 / 113 = 3.141593 is approximating the value of PI with the absolute error of only about 2*10^7. You are to find the best integer approximation of a given floatingpoint number A within a given integer limit L. That is, to find such two integers N and D (1 <= N, D <= L) that the value of absolute error A  N / D is minimal.
Process to the end of file.
Source: Northeastern Europe 2001, FarEastern Subregion 