题解 | #数据分类处理#

数据分类处理

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

= input().split()[1:]

= list(map(int,set(input().split()[1:])))

R.sort()

count = 0

res = ''

for i in map(str,R):

    single_res = ''   

    i_count = 0

    for j in range(len(I)):

        if i in I[j]:

            single_res += str(j)+' '+I[j]+' '

            

            count += 2

            i_count += 1

    if i_count:

        count += 2

        single_res = i+' '+str(i_count)+' '+single_res

    res += single_res

print(str(count)+' '+res)

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务