Cricket Rating
Practice
4.3 (58 votes)
Ad Hoc
Algorithms
Approved
Easy
Implementation
Open
Problem
92% Success 20956 Attempts 20 Points 3s Time Limit 256MB Memory 1024 KB Max Code

India is a cricket crazy nation. Chang also loves cricket and computations related to cricket. Chang has created a Cricket app.This app analyses the performance of a cricketer. If a cricketer under-performs, then a negative rating is awarded. If performance is good, then positive rating is awarded to the cricketer.Chang wants to analyse the performance of a cricketer over a period of N matches. Chang wants to find consistency of a cricketer. So he wants to find out the maximum consistent sum of cricket rating of a batsman or a bowler only if his overall rating is positive over that period. Help chang in doing so.

Input

The first line contain number of matches "N" over which the analysis is to be done. The second line contains those ratings of a batsman/bowler in those N matches.

Output

Print a single integer ie. the maximum consistent sum of rating of the cricketer if it is positive otherwise output 0 (zero).

Constraint

\(0 \le N(matches) \le 10^5\)

\(-100 \le rating \le +100\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
58 votes
Tags:
ArraysEasyMath
Points:20
54 votes
Tags:
Basic ProgrammingC++
Points:20
5 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation