F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

ZCC Loves Intersection

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 568    Accepted Submission(s): 283


Problem Description
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.
 

Input
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.
 

Output
For each test case, output a line with an integer or an irreducible fraction p/q, which is the Expectation.
 

Sample Input
2 2 3 3 5 5
 

Sample Output
1 49/81 18/625
 

Hint
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.
 

Author
Õòº£ÖÐѧ
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-08 23:20:40, Gzip enabled