题解 | #Kevin is Counting Stars#

Kevin is Counting Stars

https://ac.nowcoder.com/acm/problem/261520

    a.sort()
    res = 0
    for i in range(1, n - 1):
        res += a[i]
    if a[1] < a[n-1]:
        res += 1
    return res
t=int(input())
for i in range(t):
    n=int(input())
    b=list(map(int,input().split()))
    print(solve(n,b))




全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务