Category
Similar Problems
0712. AFA Function
Time limit : 1000 ms
Memory limit : 64 mb
Given a sequence of n integers. By definition, AFA(i, j) is the sum of all elements of the specified sequence between the indices i and j, inclusive, for 1 ≤ i ≤ j ≤ n. Find the minimum of the function.
Input
The inputs are two lines: the first contains the number N (1 ≤ N ≤ 1000), the second - a sequence of N numbers. The value of any element of a sequence to the module does not exceed 106. The numbers are separated by spaces.
Output
Bring minimum of AFA.
Samples
№ |
Input |
Output |
1 |
2 1 5 |
1 |
2 |
3 -5 3 -7 |
-9 |
Text from: e-olimp.com