Все задачи на 5.10.17 13:00

This commit is contained in:
2017-10-05 13:08:02 +03:00
parent 93746b05d7
commit ca2ca71f63
120 changed files with 2343 additions and 0 deletions

23
uts/uts_17_aut_py/3/A.py Normal file
View File

@@ -0,0 +1,23 @@
from itertools import permutations
n = int(input())
pool = list(map(int, input().split()))
pool.reverse()
maxim = 0
def play(nel):
c_nush = 0
c_bara = 0
last = 0
for cookie in nel:
if c_nush > c_bara:
c_bara += cookie
last = 1
elif c_bara > c_nush:
c_nush += cookie
last = 0
elif c_bara == c_nush and last == 0:
c_nush += cookie
elif c_bara == c_nush and last == 1:
c_bara += cookie
return c_nush
maxim = play(pool)
print(maxim)