First of all, we draw the buildings..
We need to find the value of x, yellow color in the draw... to do that, I need to apply

The value of y, will be:

Finally, with the value of A=42 and y = 174

And the building A is 193.33 feet until the building B.