Advertisement 1 | Advertisement 2 |
---|
明月别枝惊TLE,清风半夜鸣TLE。TLE里说丰年,看取TLE一片。七八个TLE外,两三点TLE前。旧时TLE社林边,路转TLE忽见。 | #include using namespace std; int main() {for (int i = 1; i <= 10; i++) if (2 <= i && i <= 4) cout << "TLE"; else cout << "AC"; return 0;} |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, c;
int cnt = 0;
cin >> n >> c;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (int i = n - 1; i > 0; i--) {
for (int j = i - 1; j >= 0; j--) {
if (a[i] - a[j] == c) cnt++;
}
}
cout << cnt;
return 0;
}