The ant would move straight diagonally from A to B. That is the shortest distance.
First let's find diagonal length between the 7 in and 12 in. Let it be x.
By Pythagoras' theorem.
x² = 7² + 12²
x² = 49 + 144
x² = 193
Next is to find the hypotenuse between the 9 in and the x above.
By Pythagoras Theorem again, let the new hypotenuse be y.
y² = x² + 9² Recall x² = 193
y² = 193 + 81
y² = 274
y = √274 in
Option C.