不愧是SP测机题。。。。 竟没人用python,那就写一发吧 C++复制while(1): #一直循环 a=int(input()) #读入 if(a!=42): print(a) else: break #退出循环