cswork / OA打开练习工作台

NvidiaOA #4

Split Array into Two Subarrays (Left Sum > Right Sum)

估计简单可在线判题

考点(AI 标注)前缀和区间

Split the whole array into two non-empty contiguous parts, and count the split positions where the left sum is strictly greater than the right sum.

This site uses a standard input/output protocol.

输入格式

The first line contains N (2..100000), and the second line contains N integers (−10000..10000).

输出格式

Output a single integer, the answer.

样例 1

输入:

3
10 -5 6

输出:

1

样例 2

输入:

3
0 0 0

输出:

0

样例 3

输入:

3
-1 -2 -3

输出:

1

样例说明

Example 1: 10|−5,6 is valid and 10,−5|6 is not, so the answer is 1. Example 2: equality does not count, so the answer is 0. Example 3: −1>−5 and −3=−3, so only the first split is valid; the answer is 1.