To solve the problem, we need to determine how long it takes to fill the tank when all three pipes A, B, and C are opened simultaneously, while also considering the times when pipes A and C are closed.
### Step-by-Step Solution:
1. **Determine the rates of each pipe:**
- Pipe A can fill the tank in 30 hours, so its rate is \( \frac{1}{30} \) tanks per hour.
- Pipe B can fill the tank in 36 hours, so its rate is \( \frac{1}{36} \) tanks per hour.
- Pipe C can fill the tank in 28 hours, so its rate is \( \frac{1}{28} \) tanks per hour.
2. **Calculate the combined rate of all three pipes:**
\[
\text{Combined rate} = \frac{1}{30} + \frac{1}{36} + \frac{1}{28}
\]
To add these fractions, we first find a common denominator. The least common multiple (LCM) of 30, 36, and 28 is 1260.
- Convert each rate:
\[
\frac{1}{30} = \frac{42}{1260}, \quad \frac{1}{36} = \frac{35}{1260}, \quad \frac{1}{28} = \frac{45}{1260}
\]
- Now add them:
\[
\text{Combined rate} = \frac{42 + 35 + 45}{1260} = \frac{122}{1260} = \frac{61}{630} \text{ tanks per hour}
\]
3. **Calculate the effective filling time before closing pipes A and C:**
- Let \( t \) be the total time taken to fill the tank.
- For the first \( t - 5 - 8 = t - 13 \) hours, all three pipes are open.
- In this time, the amount of the tank filled is:
\[
\text{Amount filled} = \left( \frac{61}{630} \right) (t - 13)
\]
4. **Calculate the filling time after closing pipes A and C:**
- After 5 hours, pipe A is closed, and after 8 hours, pipe C is closed. Thus, for the last 5 hours, only pipe B is open.
- The amount filled in the last 5 hours with only pipe B is:
\[
\text{Amount filled by B} = \frac{1}{36} \times 5 = \frac{5}{36}
\]
5. **Set up the equation for the total tank filled:**
- The total amount filled must equal 1 tank:
\[
\left( \frac{61}{630} \right)(t - 13) + \frac{5}{36} = 1
\]
6. **Solve for \( t \):**
- First, convert \( \frac{5}{36} \) to have a common denominator of 630:
\[
\frac{5}{36} = \frac{5 \times 17.5}{630} = \frac{87.5}{630}
\]
- Substitute back into the equation:
\[
\left( \frac{61}{630} \right)(t - 13) + \frac{87.5}{630} = 1
\]
- Multiply through by 630 to eliminate the denominator:
\[
61(t - 13) + 87.5 = 630
\]
- Distributing gives:
\[
61t - 793 + 87.5 = 630
\]
- Simplifying:
\[
61t - 705.5 = 630
\]
- Adding 705.5 to both sides:
\[
61t = 1335.5
\]
- Finally, divide by 61:
\[
t = \frac{1335.5}{61} \approx 21.9 \text{ hours}
\]
### Final Answer:
The tank was filled in approximately 21.9 hours.