Explanation:
A can do 1/(t+2) of the task in 1 hour.
B can do 1/(t+18) of the task in 1 hour.
t×1/(t+2) + t×1/(t+18) = t/t = 1 (the full task is done)
t + t×(t+2)/(t+18) = t+2
t×(t+18) + t×(t+2) = (t+2)(t+18)
t² + 18t + t² + 2t = t² + 20t + 36
2t² + 20t = t² + 20t + 36
2t² = t² + 36
t² = 36
t = 6