complete 10899.py
This commit is contained in:
15
zeta_python/completed/10899.py
Normal file
15
zeta_python/completed/10899.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
if __name__ == "__main__":
|
||||||
|
P, N = map(int, input().split())
|
||||||
|
S = list(map(int, input().split()))
|
||||||
|
S.sort(reverse=True)
|
||||||
|
I = []
|
||||||
|
P -= 1
|
||||||
|
for _ in range(N):
|
||||||
|
s = S.pop()
|
||||||
|
if P - s < 0:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
I.append(P)
|
||||||
|
P -= s
|
||||||
|
|
||||||
|
print(len(I), sum(I))
|
||||||
Reference in New Issue
Block a user