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.

# | User | Rating |
---|---|---|

1 | tourist | 3555 |

2 | wxhtxdy | 3519 |

3 | Radewoosh | 3408 |

4 | Benq | 3368 |

5 | mnbvmar | 3280 |

6 | ecnerwala | 3277 |

7 | LHiC | 3276 |

8 | sunset | 3264 |

9 | maroonrk | 3158 |

10 | TLE | 3145 |

# | User | Contrib. |
---|---|---|

1 | Errichto | 189 |

2 | Radewoosh | 177 |

3 | tourist | 173 |

4 | antontrygubO_o | 172 |

5 | Vovuh | 166 |

5 | PikMike | 166 |

7 | rng_58 | 158 |

8 | majk | 156 |

9 | Um_nik | 153 |

9 | farmersrice | 153 |

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.

Revisions

Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|

en3 | Logarithmic | 2017-02-05 19:23:48 | 36 | |||

en2 | 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 | Logarithmic | 2017-02-04 19:08:41 | 236 | Initial revision (published) |

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/07/2019 01:01:49 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|