public class jumpGame {
public static int jump(int[] nums){
int res = 0;
int nowCover = 0;
int nextCover = 0;
for(int i = 0 ; i < nums.length;i++){
nextCover = Math.max(nextCover,i+nums[i]);
if(i==nowCover){
if(nowCover!=nums.length-1){
res++;
nowCover = nextCover;
}
}
}
return res;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输入数组长度n");
int n = sc.nextInt();
int[] nums = new int[n];
for(int i = 0; i < n;i++){
nums[i] = sc.nextInt();
}
System.out.println("最小跳为"+jump(nums));
}
}