After how much time, in total is the tank full again given the following conditions? 
A tank is full of water.A drain pipe,which can empty the full tank in 60 minutes,is opened.18 minutes later another pipe which can fill the empty tank in 30 minutes is opened.After how much time, in total is the tank full again?

options:
a) 18 b)20 c) 36 d)40
My approach:
Tank (A) can empty in 60 minutes.
(A) done work $=-\frac{1}{60}$
Lets another tank say (B), can empty in 30 minutes $=\frac{1}{30}$ 
but after 18 minutes 
I am not getting how to use these 2 forms to solve the problem.
Can anyone guide me how to solve the problem?
 A: Hint: Set an arbitrary number as the volume of the tank (maybe 60 gallons?). Find the water in the tank at t=18 minutes. At this point the rate of water changes as it begins to be filled again. At some later time (t) the tank is full again.
A: ooops, I calculated time after the 18 minutes for another 18 minutes.  I didn't calculate for 36 minutes total.  Try again*
$d$ = Rate of drain pipe: -1/60
$f$ = Rate of fill pipe: 1/30
Rate of filling with both pipes going:$ f - d$
$S$ = How full was the tank after 18 minutes: $ 1 - 18d$.
$t$ = total time:  variable 
time running both pipes: $t - 18$
How full is the tank after running both pipes  minutes: $ S + (f-d)*(t -18)$
How long will it take the tank to fill:  solve for
$S + (f -d)*(t - 18) = 1$
A: Hint:
the velocity of water at drain pipe is
$$v=\sqrt{2gh}$$
while the velocity of other pipe is constant
so
the height of water when the tank is full
$$h=v.t$$
$$h=\sqrt{2gh}.60$$
then you can complete the solution as follow:
the height of water after $18$ minutes 
$$h_1=\sqrt{2gh}.18$$ 
then
$$h=h_1+h_2$$
