题解 | #数据分类处理#

数据分类处理

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

import sys
while True:
    try:
        I = input().strip().split()[1:]
        s_r = input().strip().split()
        #先转成数值排序
        R = sorted(list(map(int, set(s_r[1:]))))
        #再换回字符串
        R = list(map(str,R))
#         print(I)
#         print(R)
        Res = []
        for c in R:
            find = []
            for index in range(len(I)):
                if c in I[index]:
                    find.append(index)
                    find.append(I[index])
            if len(find) > 0:
                Res.append(c)
                Res.append(len(find) // 2)
                Res = Res + find
        Res.insert(0, len(Res))
        print(" ".join(map(str,Res)))

    except:
#         print(sys.exc_info())
        break


















全部评论

相关推荐

01-29 15:45
已编辑
华中科技大学 前端工程师
COLORSN:可以试一下,小厂看技术栈是不是很落后,如果太拉胯就别去,个人认为有实习氛围比你自己琢磨要高效不少,然后就是小厂其实也有可能会问的很难,这都比较难说,还是看自己项目含金量够不够,寒假还能不能推进学习再选择,毕竟去实习过年就10天假了
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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