solutions: 160A

This commit is contained in:
Muhammad Nauman Raza 2025-01-11 14:24:59 +00:00
parent b833f7e889
commit e2b512e02a
Signed by: devraza
GPG key ID: 91EAD6081011574B

25
solutions/twins.py Normal file
View file

@ -0,0 +1,25 @@
n = int(input())
a = [int(c) for c in input().split(' ')]
vals = []
def find(a):
count = 0
first = 0
second = sum(a)
for i in a:
first += i
second -= i
count += 1
if first > second:
vals.append(count)
break
if len(vals) >= 2:
return
find(a[::-1])
find(sorted(a))
print(min(vals))