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: 311ms
Memory: 25316kB
Author: 13566285241
In contest: 1300

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