Topic links:
https://pintia.cn/problem-sets/994805260223102976/problems/994805260780945408
analysis:
The number of times a difference is present in the array corresponding to a position, and from a [n-1] is greater than a start determination, if greater than 1, the number of landmarks and the output until a [0] end use while ( n--) just achieved.
AC Code:
1 #include<stdio.h> 2 3 int main(void) 4 { 5 int n=0,m=0,i=0,a[10008]={0}; 6 scanf("%d",&n); 7 for(i=1;i<=n;i++) 8 { 9 scanf("%d",&m); 10 ++a[m-i<0?i-m:m-i]; 11 } 12 while(n--) 13 if(a[n]>1) 14 printf("%d %d\n",n,a[n]); 15 return 0; 16 }