#携程笔试# 半凉经携程21届春招数据分析专业笔试一共2道题:Python+SQL,python的是求数字d的平方差分解,SQL是检索起始站和终点站的一览表。python的可以直接三层for循环+if判断完成,通过代码如下:d=int(input())count=0for a in range(d): if a*a for b in range(d): if a*a+b*b for c in range(d): if a*a+b*b+c*c==d: count+=1 breakif count==0: print(0)else: print(1)SQL的难在于如何判断“上海-北京”和“北京-上海”是同一路线或者车次,当时没有解出来。table名:train_stopstations ,原始表格如下图:看了其他贴的评论,方知解答思路如此简单明了:SELECT t1.station as deo,t2.station as arr,t1.trainnumber from train_stopstations as t1inner join train_stopstations as t2on t1.trainnumber=t2.trainnumberand t1.no<t2.no