# coding:utf-8 import sys Input = [] while True: line = sys.stdin.readline() if not line: break Input.append(line.split('\n')) num = Input.pop(0) node = [] for i in xrange(len(Input)): node.append(Input[i][0].split(' ')) print node # 建立树节点字典 shu_dict = {} for i in xrange(len(node)): shu_dict[int(node[i][1])] = int(node[i][0]) all_high = [] if num == 1: print 1 else: for key in shu_dict.keys(): high = 2 while shu_dict[key] != 0: high += 1 key = shu_dict[key] all_high.append(high) print max(all_high)
点赞 评论

相关推荐

牛客96763241...:杭电✌️也是打完招呼,没人回吗
点赞 评论 收藏
分享
10-25 22:20
门头沟学院 Java
代码飞升:同学院本,个人亮点去了,打招呼里面的废话也去了,学院本就是路边一条,明天拉满然后该学还是学,小厂也行尽量先有一段实习。另外你的项目描述写的不好,具体列一下可被提问的点,然后量化一下指标或者收益吧
投了多少份简历才上岸
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务