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

建议使用的浏览器:

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

2103:Jackpot

题目描述
The Great Dodgers company has recently developed a brand-new playing machine.
You put a coin into the machine and pull the handle. After that it chooses some integer number. If the chosen number is zero you win a jackpot. In the other case the machine tries to divide the chosen number by the lucky numbers p1 , p2 , . . . , pn . If at least one of the remainders is zero --- you win.
Great Dodgers want to calculate the probability of winning on their machine. They tried to do it, but failed. So Great Dodgers hired you to write a program that calculates the corresponding probability.
Unfortunately, probability theory does not allow you to assume that all integer numbers have equal probability. But one mathematician hinted you that the required probability can be approximated as the following limit:
limk→∞(Sk/2k+1).

Here Sk is the number of integers between -k and k that are divisible by at least one of the lucky numbers.
输入解释
Input file contains n --- the number of lucky numbers (1 <= n <= 16), followed by n lucky numbers (1 <= pi <= 109 ).
输出解释
It is clear that the requested probability is rational. Output it as an irreducible fraction.
On the first line of the output file print the numerator of the winning probability. On the second line print its denominator. Both numerator and denominator must be printed without leading zeroes. Remember that the fraction must be irreducible.
输入样例
2
4 6
输出样例
1
3
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

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

源链接: POJ-2103

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

共提交 0

通过率 --%
时间上限 内存上限
20000 64000