Toggle navigation
YouTube
Facebook
Telegram
english
english
українська
Algotester 4.3
Build 496
2024-10-17
Log In
Contact Us
College
Sponsors
Donate
Sources
PyPy
n = int(input()) a = [int(i) for i in input().split()] s = 0 for i in range(n): s += a[i] p = a[0] ans = 2 * p - s for i in range(1, n): ans = max(ans, 2 * p - s) p += a[i] print(ans)