Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define MAX 1000007
- using namespace std;
- int arr[MAX];
- int main(){
- int q; scanf("%d", &q);
- while(q--){
- int n; scanf("%d", &n);
- for(int i = 0; i < n; i++) scanf("%d", &arr[i]);
- int idx = 1, day = 0;
- long long pick = arr[0];
- while(idx < n){
- long long acum = 0;
- for(; idx < n && pick >= 0; idx++, pick--){
- acum += arr[idx];
- }
- pick = acum;
- day++;
- }
- printf("%d\n", day);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement