Theory of surface segregation in transition-metal alloys