I'm not sure if you meant to say that pipe C is emptying while A and B are filling, but I will assume that you meant to say exactly what you said.
If the tank starts out dry, then how long does it take to fill if one pipe is draining the tank as the other two pipes are filling it?
To solve this, you have to convert the figures to flow rates:
Pipe A fills one tank by itself (with no drain) in 20 minutes, which means 20 minutes per tank or 3 tanks per hour.
Pipe B fills one tank by itself (with no drain) in 30 minutes, which means 30 minutes per tank or 2 tanks per hour.
Together, they fill 5 tanks per hour.
Pipe C can empty one tank (with no other pipes pouring in) in 40 minutes, which means 40 minutes per tank or 1.5 tanks per hour.
So if all three pipe are working in concert starting with a dry tank, where pipes A and B are filling the tank while C is emptying it, then you simply add the rates of pipes filling the tank and subtract the rates of pipes emptying the tank: 5 - 1.5 = 3.5 tanks per hour. Last, you'll need to convert that to the number of minutes for one tank (convert hours to minutes and take the reciprocal).
-- On the other hand, if you meant to say that each pipe fills the tank by itself in those minutes (A, B, and C are all filling), then you have nothing to subtract. Just add the flow rates and convert to minutes the same way.
Stephen La Rocque.>