In the period between Nov. 28, 00:00 (UTC) and Nov. 28, 02:30 (UTC) Codeforces and Polygon will be possibly unavailable because of maintenance. ×

Finding fraction which has the smallest denumerator

Revision en2, by Logarithmic, 2017-02-04 19:51:28

Given a range (l, r) where 0.0 <= l,r <= 1.0 we want to find a fraction x/y which satisfies following condition: l <= x/y < r and y should be as small as possible. l and r might have at most 9 digits after floating point.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Logarithmic 2017-02-05 19:23:48 36
en2 English Logarithmic 2017-02-04 19:51:28 37 Tiny change: '<= x/y < r. l and r ' -> '<= x/y < r and y should be as small as possible. l and r '
en1 English Logarithmic 2017-02-04 19:08:41 236 Initial revision (published)