It would depend on the aviation authority where the aircraft are registered.
My take on with would be that the A330 and A340 (all series) would count as one license. The 777-200 and -300 also count as one license. With the 747 making a third license.
If this was the UK, then yes, it would be legal. I can't think of any countries off the top of my head that would not allow 3 licenses. Happy to be corrected though.