#第二题 ac trans = {"a":10,"b":11,"c":12,"d":13,"e":14,"f":15} result = {} seen = {} find = 0 def get_id(string): count = 0 for i in string: if i in trans: i = trans[i] else: i = int(i) count = count * 16 + i return count def start1(start,key): global find,seen if key in result: # print start,"key_list:",result[key]["after"] if start in result[key]["after"]: find = 1 else: for item in result[key]["after"]: # print "in",item if not seen[item]: seen[item] = True start1(start,item) def clear(): global seen for key,value in seen.items(): seen[key] = False # count = 0 while True: flag = 1 data = raw_input() if "}," not in data: flag = 0 id1 = data.split(",")[0].replace("{","").strip() id2 = data.split(",")[1].replace("}","").replace(",","").strip() if id1 in result: result[id1]["after"].append(id2) else: result[id1] = {"index":get_id(id1.replace("0x","")),"after":[id2]} if id2 not in result: result[id2] = {"index":get_id(id2.replace("0x","")),"after":[]} if id1 not in seen: seen[id1] = False if id2 not in seen: seen[id2] = False if flag == 0: break # print count result_list = [] for key,value in result.items(): # print key clear() seen[key] = True start1(key,key) # print "find",find if find == 0: result_list.append([value["index"],key,"false"]) else: result_list.append([value["index"],key,"true"]) find = 0 this_count = 0 for item in sorted(result_list,key = lambda x:x[0]): this_count += 1 # print this_count if (this_count == len(result_list)): print "{"+item[1]+", "+item[2]+"}" else: print "{"+item[1]+", "+item[2]+"},"
点赞 评论

相关推荐

书海为家:实习是成为大厂正式员工很好的敲门砖,看您的简历中有一段实习经历,挺好的。我来给一点点小建议,因为毕竟还在学校不像工作几年的老鸟有丰富的项目经验,面试官在面试在校生的时候更关注咱们同学的做事逻辑和思路,所以最好在简历中描述下自己实习时做过项目的完整过程,比如需求怎么来的,你对需求的解读,你想到的解决办法,遇到困难如何找人求助,最终项目做成了什么程度,你从中收获了哪些技能,你有什么感悟。
点赞 评论 收藏
分享
在笔试的大西瓜很矫健:校招数分不用想了,这经历和学历都不够用,大厂更别想,初筛都过不了,说点不好听的小厂数分都进不去(小厂也是假数分),要两个对口实习+3个项目(或者3+2),而且要有含金量才能补一点你的学历劣势。 建议刷实习,社招找数分,校招看运气,能入行业就行,可以运营转数分
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务