BALLSUM  Ball sum
You have a bag filled with N balls.Each Ball has a distinct number from 1 to N printed on it.All the numbers are distinct. You withdraw two balls from the bag and take their sum. You need to calculate the probability that the sum is not greater than the given number K(<=N). The Answer should be displayed in the form of p/q.(except when the answer is 0 or 1)
Input
Input consists of various test cases. Each test case consist of two integer inputs,N and K. (0<=K<=N<=1000000000) The program stops taking input when N and K equals 1
Output
Output the result in the form of p/q.(Except when the answer is 0 or 1)
Example
Input: 3 2 100 5 10 6 1 1 Output: 0 2/2475 2/15
hide comments
damsehgal:
20160103 23:47:56
are you withdrawing 2 balls together or are you withdrawing a ball and then putting it back and then taking i out again?


gomathi ganesan:
20151228 07:34:48
Easy problem :D 

dwij28:
20151226 19:13:08
Nice, logarithmic time solution .. :) 

[Lakshman]:
20151223 16:43:52
@nikhilkamat2 Yes.


nikhilkamat2:
20151223 16:37:24
Do we have to print the fractions in lowest terms? 

Shubham Dash:
20151222 14:44:31
[code removed] my solution is giving TLE even in O(n)....can anyone guide me? Last edit: 20151222 15:41:57 

Sanchit Kumar:
20151221 08:52:42
@prrateekk It should be mentioned that N >= 2, as we need to pick 2 balls. Last edit: 20151221 08:53:13 

Prakhar Dev Gupta:
20151218 04:00:29
.


Vipul Srivastava:
20151216 09:50:38
Last edit: 20151216 10:52:38 

Prateek Agarwal:
20151215 19:05:53
@brandon105 Changes have been made to the test cases. 
Added by:  Prateek Agarwal 
Date:  20151215 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 GOSU JSMONKEY 