You are viewing a single comment's thread. Return to all comments →
#include <bits/stdc++.h> using namespace std; int main(){ int n,a[100000]; cin>>n; for(int i=0;i<n;i++) cin>>a[i]; int x=a[0], count=0, y=0; while(y<n) { y+=(x+1); x=a[y]; count++; } cout<<count; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Recover the Arrays
You are viewing a single comment's thread. Return to all comments →