题解 | AOE还是单体?

AOE还是单体?

https://www.nowcoder.com/practice/84dec7e96e3d4f75808b47e1b8b0280c

n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
a.sort()
if x >= n :
    print(sum(a))
else :
    for i in range(n-x,n):
        a[i] -= a[n-x-1]
    print(a[n-x-1]*x + sum(a[n-x:n]))

全部评论

相关推荐

KKorz:是这样的,还会定期默写抽查
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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