二、代码 1#include<iostream>2#include<cstring>3#include<algorithm>4#include<cstdio>5#defineLL long long6usingnamespacestd;7constintN=400050;8constintbase=N/2;//偏移量9ints[N];10intn;11LL res;12intmain(){1314intT;15
Codeforces Round #719 (Div. 3) D. Same Differences 技术标签: 题解 算法 c++题目: 题目链接 题解: 把题目稍微变形一下就可以变成 a a a i i i - i i i = a a a j j j - j j j 在输入的时候把数据处理为 a a a i i i = a a a i i i - i i i,然后计数这个数出现的次数 ...
The second line of each test case contains n integers a1,a2,…,an (1≤ai≤n) — array a. It is guaranteed that the sum of n over all test cases does not exceed 2⋅105. Output For each test case output the number of pairs of indices (i,j) such that i<j and aj−ai=j−...