本文共 905 字,大约阅读时间需要 3 分钟。
33 11111 22222 555552 33333 444444 55555 66666 99999 77777855555 44444 10000 88888 22222 11111 23333 88888
10000 88888 23333
33 11111 22222 555552 33333 444444 55555 66666 99999 77777455555 44444 22222 11111
No one is handsome
amount = int(input())#找出有朋友的人来friends = set()for i in range(amount): line = input().split() #朋友圈只有自己相当于没朋友 if(line[0] == "1"): pass else: for people in line[1:]: friends.add(people)#print(friends)amountOfsearch = int(input())#存储已经查找过的人people_searched = set()#没有朋友的人no_friends_list = []#需要查找的人want_to_search = input().split(" ")for people in want_to_search: #如果没朋友而且没有查找过存放在结果列表中 if(people not in friends and people not in people_searched): people_searched.add(people) no_friends_list.append(people)if(len(no_friends_list) == 0): print("No one is handsome")else: print(" ".join(no_friends_list))
转载地址:http://bpwwi.baihongyu.com/