This one I solved via formula W = RT, R is rate and T is time. Took 3 mins of time...

Given m units of work is done by A and B in 1 hours..Let me take rate of work by A be X and rate of work by B be Y
=> m = (X + Y)1 => m = X + Y ------eq 1.
Now A's work
=> 2m = XT => X = 2m/T ---eq 2.
Now B's work
=> 2m = Y ( T - 3) => Y = 2m/T-3 ----eq 3.
Sub eq 2 and 3 in eq 1.
=> m = 2m/T + 2m/T-3
=> m(T-3)T = 2m(T-3) + 2mT.
=> m(T-3)T = m{ 2(T-3) + 2T} .
=> T^2 - 3T = 2T - 6 + 2T ( eliminating m)
=> T^2 - 7T + 6 = 0.
=> (T-6)(T-1) = 0.
T = 6 or 1. Here 1 can't be the value because it has given that B has three hours less or else we get negative value. Hence it has to be 6.
Sub in eq 2..... 2m = X*6
m = X * 3....because we need to find A's 5m work.
For m units of work , X takes 3 hours.
then for 5m units , X takes = 3 * 5m / m =15 hours.