题解 | #数据分类处理#

数据分类处理

https://www.nowcoder.com/practice/9a763ed59c7243bd8ab706b2da52b7fd

I = input().split()
R = input().split()
I_arr = I[1: int(I[0])+1]
R_arr = sorted(list(set([int(x) for x in R[1:int(R[0])+1]])))

out = []
for ri in R_arr:
    p = [[i,x] for i,x in enumerate(I_arr) if str(ri) in x]
    if len(p) >0:
        out = out + [str(ri),str(len(p))]+[str(element) for row in p for element in row]
print(len(out),' '.join(out))

全部评论

相关推荐

码农索隆:这种hr,建议全中国推广
点赞 评论 收藏
分享
05-29 22:11
门头沟学院 Java
Elastic90:抛开学历造假不谈,这公司的招聘需求也挺怪的,Java开发还要求你有图文识别、移动端开发和c++的经验,有点逆天了。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务