Start: Apr, 17, 2017 10:00:00
Python程序设计基础培训第四次作业
End: Apr, 23, 2017 14:00:00
Contest has ended!
Time elapsed: 148:00:00
Time remaining: 00:00:00

Problem_ID: A
Result: Accepted
Time: 752ms
Memory: 21428kB
Author: 15606823587
In contest: 1088

1
2
3
4
5
6
7
8
9
10
11
12
13
ncase = int(raw_input())
for t in range(ncase):
	ss=0
	n,m,k = map(int,raw_input().strip().split())
	s=map(int,raw_input().strip().split())
	s.sort()
	for j in range(m):
		ss=ss+s[j]
	cc=ss-n
	if cc>0:
		print cc
	else:
		print 0