Mathematically this is whole simple. Just take the speed, multiplied by gamma and you get the speed of the ship it has when you take Einstein's formulae. Like that, the travel is for B much shorter than for A. This should be common knowledge for everyone seriously into game programming as it is mathematically trivial.