The assignment of professors and graduate students in the Institute…

Question Answered step-by-step The assignment of professors and graduate students in the Institute… The assignment of professors and graduate students in the Institute is based on the method of filling in the order of volunteers. Please design a program that meets the following requirements to help match professors and graduate students in this Institute. 1. Assuming that there are ten graduate students (numbered A1~A10) and ten professors (numbered B1~B10), each professor must assign a graduate student. Each graduate student proposes a volunteer order, which consists of the numbering order of ten professors. For example, the volunteer order of A1 can be (B5, B2, B9, B4, B10, B8, B3, B6, B7, B1), and the order is in The former takes precedence. Each professor also proposes a voluntary order, which consists of the numbering order of ten graduate students. For example, the voluntary order of B5 can be (A7, A2, A1, A6, A10, A8, A3, A5, A4, A9). The former takes precedence. 2. The main matching principle is based on the order of the graduate students’ voluntary choice. The first choice of each graduate student will be matched. If the first choice is unsuccessful, the second, third, and fourth choices will be matched in sequence. For example, in the following example, among the ten graduate students, only A8’s first choice is B7, and there are no other competitors, so B7 is the supervisor of A8. If there are two or more first choices of the same professor, then the order of the professors’ preferences must be determined. For example, the three graduate students A1, A2, and A6 all have B5 as their first priority, and only A2 can be successfully paired. Because the B5 professor’s volunteer order, A2 is in the front. If the first choice professor selected by the student has been successfully matched, the student can only be matched with the second, third and fourth choice in sequence. For example, A1’s first-choice professor B5 has been paired with A2, then continue to choose the second-choice professor B2, but A7’s second-choice is also B2 (A7’s first-choice B10 has not been paired successfully), and the priority of B2’s supervisor It is A7 in the front, so A1 can only continue to choose the third choice B9, and compete with A3 and A9 to be successfully paired.Input description:Input data, there are 20 columns of data, the order is the voluntary sequence of A1~A10 and B1~B10. The first information in each column is the graduate student number (A1~A10) or the professor number (B1~B10), and the following information is the voluntary sequence of the graduate student or professor, expressed in numbers from 1 to 10, and the sequence of each voluntary They are separated by commas (,). The numbers in the postgraduate volunteer order represent the professor’s number (B1~B10), while the number in the supervisor’s preference order represents the graduate student’s number (A1~A10).Output description: Please output the matching results on the screen. The matching results of the graduate students and professors must be output in ten columns (ten strokes) in the order of the graduate student number (A1~A10). For example, A1,B9 represent a pairing result between the graduate student of A1 and the supervisor of B9, separated by commas (,).Example input:A1,5,2,9,4,10,8,3,6,7,1A2,5,10,8,4,9,3,2,6,1,7A3,6,2,9,8,10,3,1,7,5,4A4,10,2,6,8,7,9,3,1,4,5A5,6,3,9,2,10,8,4,5,7,1A6,5,2,7,9,8,4,1,6,3,10A7,10,2,7,4,5,8,3,6,9,1A8,7,3,9,8,10,2,1,6,5,4A9,3,2,6,8,7,9,10,1,4,5A10,6,2,9,8,10,3,4,5,7,1B1,1,2,7,6,3,8,10,9,4,5B2,2,7,3,6,10,9,1,5,4,8B3,8,5,1,9,10,7,3,2,4,6B4,7,10,3,6,2,8,9,4,5,1B5,7,2,1,6,10,8,3,5,4,9B6,5,3,1,4,10,8,2,7,6,9B7,7,2,1,5,8,10,3,6,9,4B8,1,2,6,10,7,8,3,9,4,5B9,6,4,1,10,3,8,7,5,2,9B10,2,9,4,5,10,8,1,6,3,7Example output:A1,B9A2,B5A3,B1A4,B10A5,B6A6,B4A7,B2A8,B7A9,B3A10,B8 Computer Science Engineering & Technology C++ Programming Share QuestionEmailCopy link Comments (0)