Analytical solutions for laser excitation of multilevel systems in the rotating-wave approximation