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

建议使用的浏览器:

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

4873:ZCC Loves Intersection

题目描述
After beats all opponents in 3-dimension-world OI, ZCC feels bored and sets about going to other universes. In a universe with D dimension(s), ZCC finds D segments floating in the air. To be more precise: if we build a rectangular coordinate system with D axis, each of the segments is parallel with one axis, whose endpoints have a coordination of which all components belong to the set {x∈Z|0≤x<N}. For each axis, there is exactly one segment parallel with it.
Each of the D segments changes location every second. Read the pseudo code below for more details:

Every second, from every pair of segments intersect, ZCC acquires a unit of Energy. Calculate the Expectation of the amount of the acquired energy per second please.
输入解释
There are several test cases in one input file. EOF indicates the end of input file.
Every test case contain two positive numbers N, D in one line.
It is guaranteed that 1<N≤10^9, D≤99. The number of test cases≤10.
输出解释
For each test case, output a line with an integer or an irreducible fraction p/q, which is the Expectation.
输入样例
2 2
3 3
5 5
输出样例
1
49/81
18/625

提示
For the first test case of the sample input, there are 2 segments in a 2*2 lattice.
Because two endpoint couldn’t coincide, two segments must be (0,y)-(1,y) and (x,0)-(x,1). (x, y∈{0,1}) 
Thus, they always intersect at (x,y). As an irreducible fraction the answer is 1/1, where q = 1, so we should output an integer 1 instead.
来自杭电HDUOJ的附加信息
Author 镇海中学
Recommend

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

源链接: HDU-4873

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)