Tổng lớn nhất


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 1G

Problem type

Cho dãy $a_1,a_2,...,a_N$. Gọi $f_i = a_1+a_2+...+a_i$. Hãy tìm giá trị lớn nhất của $f_1,f_2,...,f_N$.

Dữ liệu

  • Dòng đầu tiên chứa hai số nguyên $N \ (1\le N\le 10^5)$;
  • Dòng tiếp theo chứa $N$ số nguyên $a_i \ (|a_i| \le 10^9)$.

Kết quả

  • Kết quả bài toán.

Ví dụ

Ví dụ 1

input

5
1 -2 4 -2 -4

output

3

Comments

There are no comments at the moment.