题解 | 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]))

全部评论

相关推荐

01-30 09:45
燕山大学 Java
喵_coding:这种直接跑就完事了 哪有毕业了才签合同 任何offer和三方都没有的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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