题目:P4889 kls与flag - 洛谷 | 计算机科学教育新生态 https://www.luogu.com.cn/problem/P4889
#include<map>
#include<string.h>
#include<cstdio>
#include<cstdlib>
#define LL long long
using namespace std;
map<int,int> a;
int n,m,x;
LL ans;
int main(){
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++) {
scanf("%d",&x);
ans+=a[i+x]+a[i-x];//这句是什么意思捏
a[i+x]++;//?
a[i-x]++;//?
}
printf("%lld",ans);
}
谢谢大家!
谢谢大家!