Start: Jul, 06, 2019 10:00:00
20190706Python程序设计基础培训扩展练习
End: Jul, 17, 2019 12:00:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 312ms
Memory: 25320kB
Author: 13819973890
In contest: 1300

n=int(input())
for i in range(n):
    n,k,m=map(int,input().split())
    ls=list(map(int,input().split()))
    ls.sort()
    total=0
    for j in range(k):
        total+=ls[j]
    if total>=n:
       print(total-n)
    else:
       print(0)