博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PATpython练习题帅到没朋友
阅读量:3938 次
发布时间:2019-05-23

本文共 905 字,大约阅读时间需要 3 分钟。

在这里插入图片描述

输入样例1

33 11111 22222 555552 33333 444444 55555 66666 99999 77777855555 44444 10000 88888 22222 11111 23333 88888

输出样例1

10000 88888 23333

输入样例2

33 11111 22222 555552 33333 444444 55555 66666 99999 77777455555 44444 22222 11111

输出样例2

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/

你可能感兴趣的文章
Java魔法师Unsafe
查看>>
spring cloud java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
查看>>
Centos系统安装MySQL(整理)
查看>>
postgresql计算两点距离(经纬度地理位置)
查看>>
postgres多边形存储--解决 Points of LinearRing do not form a closed linestring
查看>>
postgresql+postgis空间数据库总结
查看>>
spring 之 Http Cache 和 Etag(转)
查看>>
基于Lucene查询原理分析Elasticsearch的性能(转)
查看>>
HttpClient请求外部服务器NoHttpResponseException
查看>>
springCloud升级到Finchley.RELEASE,SpringBoot升级到2.0.4
查看>>
Spring boot + Arthas
查看>>
omitted for duplicate jar包冲突排查
查看>>
如何保证缓存与数据库的双写一致性?
查看>>
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy排查
查看>>
深浅拷贝,深浅克隆clone
查看>>
Java基础零散技术(笔记)
查看>>
Mysql优化sql排查EXPLAIN EXTENDED
查看>>
线程之间数据传递ThreadLocal,InheritableThreadLocal,TransmittableThreadLocal
查看>>
spring循环依赖,解决beans in the application context form a cycle
查看>>
分布式锁的实现
查看>>