#C10922. Count Jumpable Elements
Count Jumpable Elements
Count Jumpable Elements
Given an array of integers, an element is considered (jumpable) if it is greater than or equal to the cumulative sum of all previous elements. Formally, let the array be ({a_1, a_2, \dots, a_n}) with the cumulative sum defined as (S_{i-1} = \sum_{j=1}^{i-1} a_j) (with (S_0 = 0)). An element (a_i) is jumpable if (a_i \ge S_{i-1}). Your task is to compute the number of jumpable elements in the given array. The first element is always jumpable.
inputFormat
The first line contains a single integer (n) ((1 \le n \le 10^5)), denoting the number of elements in the array. The second line contains (n) space-separated integers (a_1, a_2, \dots, a_n) where (0 \le a_i \le 10^9).
outputFormat
Output a single integer representing the number of jumpable elements in the array.## sample
5
1 2 2 5 1
3
</p>