Maximum sums

Write a program that reads a sequence of numbers, and prints the maximum
quantity that can be obtained by adding numbers consecutively from the
beginning, and the maximum quantity that can be obtained by adding
numbers consecutively from the end.

Input

Input consists of several cases. Each case begins with a number n,
followed by n integer numbers.

Output

For every case, print two numbers: the maximum quantity that can be
obtained by adding zero or more consecutive numbers from the beginning,
and the maximum quantity that can be obtained by adding zero or more
consecutive numbers from the end.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:08:21.423Z

© Jutge.org, 2006–2026.
https://jutge.org
