引用代码:https://blog.csdn.net/qq_35061334/article/details/117338687 我在条件里加了print()感觉容易理解多了,希望也能帮到其他学习者! def func(): while True: try: n = int(input()) trains = input().strip().split(' ') res = [] def rec_trains(cur_idx, in_trains...