题解 | #名字的漂亮度#

名字的漂亮度

https://www.nowcoder.com/practice/02cb8d3597cf416d9f6ae1b9ddc4fde3

while 1:
    try:
        N = int(input())
        
        s_list = []

        beautiful_degree = []
        

        for i in range(N):
            s_list.append(input())

        for i in range(N):
            value = []
            beautiful_value = 0
            for c in set(s_list[i]):
                value.append(s_list[i].count(c))
            n = len(value)
            for j in range(n):
                beautiful_value = beautiful_value + max(value) * (26 - j)
                value.pop(value.index(max(value)))
            beautiful_degree.append(beautiful_value)
        
        for i in range(len(beautiful_degree)):
            print(beautiful_degree[i])
    except:
        break

全部评论

相关推荐

感性的干饭人在线蹲牛友:🐮 应该是在嘉定这边叭,禾赛大楼挺好看的
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务