diff --git a/zeta_python/completed/10899.py b/zeta_python/completed/10899.py new file mode 100644 index 0000000..8595852 --- /dev/null +++ b/zeta_python/completed/10899.py @@ -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))