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

建议使用的浏览器:

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

4139:Big Division

题目描述
A theoretical physicist friend is doing research about the "Answer to the Ultimate Question of Life, the Universe, and Everything", he thinks that it is not 42 as suggested by “The Hitchhiker's Guide to the Galaxy” science fiction comedy series; instead he thinks it is the result of dividing the products of two sequences of positive integers A and B!
The task of calculating the product of A and B followed by division turned out to be not as easy as it looks, specially with the sequences being long and the products getting too large very quickly! Even using a modern computer, a straight forward implementation for the calculations may take very long time to complete! And this is where we seek your help as a brilliant computer scientist!
输入解释
The first line of input contains an integer (1 <= T <= 200), the number of test cases.
T test cases follow, the first line of each test case contains two integers (1 <= N, M<= 110,000), the lengths of sequences A and B respectively. Two lines follow, the first line contains N space separated integers (0 < A0, A1 … An <= 1,000,000), and the second line contains M space separated integers (0 < B0, B1 … Bm <= 1,000,000).
输出解释
For each test case, print one line containing the result of dividing the product of sequence A by the product of sequence B as a reduced fraction of the format “X / Y” (Notice the single space before and after the fraction sign). X and Y are guaranteed to fit in 32-bit signed integer. A reduced fraction is a fraction such that the greatest common divisor between the nominator and the denominator is 1.
输入样例
2
3 1
2 4 5
12
2 4
1 15
5 1 7 2
输出样例
Case #1: 10 / 3
Case #2: 3 / 14
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4139

最后修改于 2020-10-25T23:10:38+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 32768/32768K(Java/Others)