import sys
for s in sys.stdin:
p = s.split(" ")
if(len(p)==1):
pass
else:
d = int(p[1]) - int(p[0])
if(int(p[3])-d == int(p[2])):
print(s+" "+str(int(p[3])+d))
else:
d= int(p[3])*(int(p[3])/int(p[2]))
print(s+" "+str(int(d)))
好奇問你的code有在IDE測試過嗎?
import sys
for s in sys.stdin:
p = s.split(" ")
if(len(p)==1):
pass
else:
d = int(p[1]) - int(p[0])
if(int(p[3])-d == int(p[2])):
print(s+" "+str(int(p[3])+d))
else:
d= int(p[3])*(int(p[3])/int(p[2]))
print(s+" "+str(int(d)))
好奇問你的code有在IDE測試過嗎?