Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

Finding fraction.

Revision en3, by Logarithmic, 2017-02-05 19:23:48

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)