solutions: 160A
This commit is contained in:
parent
b833f7e889
commit
e2b512e02a
1 changed files with 25 additions and 0 deletions
25
solutions/twins.py
Normal file
25
solutions/twins.py
Normal 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))
|
Loading…
Reference in a new issue