#K13786. Taco House Energy
Taco House Energy
Taco House Energy
In this problem, participants are given a sequence of houses arranged in a circular formation, each containing a certain amount of energy. The task is to calculate the maximum energy that can be gathered if a participant starts from any house and runs to any other house. Because the houses form a circle, the maximum energy is simply the sum of the energies from all houses.
Mathematically, if there are (n) houses with energies (a_1, a_2, \dots, a_n), the answer is given by:
(\sum_{i=1}^{n} a_i).
Your solution should read the input from standard input (stdin) and produce the result in standard output (stdout).
inputFormat
The input is read from stdin and consists of two lines:
1. The first line contains a single integer (n) representing the number of houses.
2. The second line contains (n) space-separated integers representing the energy values for each corresponding house.
outputFormat
Output a single integer which is the sum of all given energy values. This represents the maximum energy that can be gathered, and it should be printed to stdout.## sample
5
1 3 5 4 2
15
</p>