#P2309. loidc,卖卖萌
loidc,卖卖萌
Description
vivym gave loidc a sequence of integers. He defines the sum of a number sequence as the sum of its elements. vivym asks loidc to find how many contiguous subarrays in the sequence have a positive sum. He thought about it for a long time but could not solve it, so he handed this tricky problem to you, who are very good at programming. He hopes you can solve it within 1 s. Otherwise, vivym will “flash over a wall and ghost-step away.”
Input Format
The first line contains an integer , the length of the sequence.
The second line contains integers — the sequence.
Output Format
Output a single integer: the number of contiguous subarrays whose sum is positive.
3
8 -9 2
3
Hint
- For of the testdata: .
- For of the testdata: .
Each element of the sequence lies between .
Translated by ChatGPT 5
京公网安备 11011102002149号