please someone help with greedy problem

Revision en6, by kaffan_69, 2020-07-12 09:15:23

please help me with this greedy problem

D fraction Now Arnab is given a fraction N/D . He is asked to divide the fraction in sum of unique unit fractions where N/D=(1/D1)+(1/D2)+(1/D3)+...+(1/Dn). Now find the value of D1,D2,....,Dn.

if (1/Di)=2 then value of Di=1/2, print it in fraction as 1/2 not as floating point number.

Input format The first line contains an integer T , denoting the number of test cases. For each test case, there are two space-separated integers N and D.

Output format For every testcase on a new line, print space separated values of D1,D2,....,Dn.

Constraints: 1<=T<=10 1<=N,D<=10000

Example Input 1 2 3

Output 2 6

Explanation We know, 2/3=1/2+1/6.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English kaffan_69 2020-07-12 09:15:23 692
en5 English kaffan_69 2020-07-12 08:12:10 65
en4 English kaffan_69 2020-07-12 08:08:04 68
en3 English kaffan_69 2020-07-12 08:05:13 64
en2 English kaffan_69 2020-07-12 08:00:44 67 Tiny change: 'dy problem' -> 'dy problem\nhttps://codeforces.com/7eaab3/Capture9990.PNG'
en1 English kaffan_69 2020-07-12 07:57:57 78 Initial revision (published)