Artificial intelligent assistant

How long will it take to fill this cistern? Pipes $A$ and $B$ call fill a cistern in $20$ and $30$ minutes and C can empty it in $15$ minutes. If the three are opened and closed after the other successively for $1$ min each in that order, how soon will the cistern be filled? So from this we can say that part filled in $3$ min $= \frac 1 {20} +\frac 1{30}-\frac 1{15} = \frac {1}{60}$th But now how to form the rest of the solution, any ideas?

Since you add $\frac{1}{20}+\frac{1}{30}$ before subtracting $\frac{1}{15}$, it is sensible to see how long it takes to fill $1-\frac{1}{20}-\frac{1}{30}$ of the tank using the three steps.

This is $\frac{11}{12}=\frac{55}{60}$ of the tank and so takes $55 \times 3 = 165$ minutes.

You then add $\frac{1}{20}$ in the $166$th minute and $\frac{1}{30}$ in the $167$th minute to reach a full tank, so the answer is $167$ minutes.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 78dfea3d42e49966d6cc81f5b2cbf12a