FUACM004 - Problems 4: Array
Son has an array of n elements a[1], a[2] ... a[n] and an integer k, today that he wants to count how many pairs of (a[i], a[j]) (1 <= i < j <= n) have been content with: max (a [i], a [j]) - min (a [i], a [j]) = k. Could you help Son?
Input
- First line, integer n and k (n<=200, k<=100)
- Second line, n integer a[1], a[2] ... a[n] (a[i]<=100)
Output
- Number of pair.
Example
Input: 4 1 1 2 3 4 Output: 3
Added by: | Gầy :)) |
Date: | 2014-11-17 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ASM32-GCC MAWK BC C-CLANG C NCSHARP CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GRV JAVA JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PAS-GPC PAS-FPC PICO PROLOG PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET |