Masala #0690
Juftlik
Sizga \(n\) ta sondan iborat \(a\) massiv beriladi, siz shu massivda \(arr_i, arr_j\) juftliklar ichidan \(arr_i - arr_j = \text{k}\) bo'ladigan juftliklar sonini topishingiz kerak.
Juftlik sifatida olish uchun quydagi shartlar bajarilishi kerak:
- \(0\leq i,j < |arr|\)
- \(i\mathrlap{\,/}{=}j\)
- \(arr[i] - arr[j] = k\)
Birinchi qatorda \(n, k\) butun sonlar\((1 ≤ n ≤ 10^4)\)\((0 \leq k \leq 10^7)\).
Keyingi qatorda \(n\) ta butun son, \(arr_1,arr_2,...,arr_n\) \((-10^{7} ≤ arr_i ≤ 10^7)\) kiritiladi.
Masala javobini chop eting.
# | input.txt | output.txt |
---|---|---|
1 |
5 2 3 1 4 1 5 |
2 |
1-test: Juftliklar, \((3,1)(3,1)(5,3)\) teng juftliklar 1 ta hisoblanadi . Demak 2 ta juftlik bor.