当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3039:Close Encounter

题目描述
Lacking even a fifth grade education, the cows are having trouble with a fraction problem from their textbook. Please help them. The problem is simple:

Given a properly reduced fraction (i.e., the greatest common divisor of the numerator and denominator is 1, so the fraction cannot be further reduced) find the smallest properly reduced fraction with numerator and denominator in the range 1..32,767 that is closest (but not equal) to the given fraction.
输入解释
* Line 1: Two positive space-separated integers N and D (1 <= N < D <= 32,767), respectively the numerator and denominator of the given fraction
输出解释
* Line 1: Two space-separated integers, respectively the numerator and denominator of the smallest, closest fraction different from the input fraction.
输入样例
2 3
输出样例
21845 32767
提示
INPUT DETAILS:
2/3

OUTPUT DETAILS:
21845/32767 = .666676839503.... ~ 0.666666.... = 2/3.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3039

最后修改于 2020-10-29T06:51:00+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536