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