#1186. 【算法1-6】A-B 数对

【算法1-6】A-B 数对

说明

给出一串正整数数列以及一个正整数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>C,要求计算出所有满足 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>−</mo><mi>�</mi><mo>=</mo><mi>�</mi></mrow></semantics></math>AB=C 的数对的个数(不同位置的数字一样的数对算不同的数对)。

输入格式

输入共两行。

第一行,两个正整数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo separator="true">,</mo><mi>�</mi></mrow></semantics></math>N,C

第二行,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 个正整数,作为要求处理的那串数

输出格式

一行,表示该串正整数中包含的满足 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>−</mo><mi>�</mi><mo>=</mo><mi>�</mi></mrow></semantics></math>AB=C 的数对的个数

样例

4 1
1 1 2 3
3

提示

数据范围:

对于 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>75</mn><mi mathvariant="normal">%</mi></mrow></semantics></math>75% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>2000</mn></mrow></semantics></math>1N2000

对于 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>100</mn><mi mathvariant="normal">%</mi></mrow></semantics></math>100% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>2</mn><mo>×</mo><mn>1</mn><msup><mn>0</mn><mn>5</mn></msup></mrow></semantics></math>1N2×105<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo>≤</mo><msub><mi>�</mi><mi>�</mi></msub><mo><</mo><msup><mn>2</mn><mn>30</mn></msup></mrow></semantics></math>0ai<230<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo><</mo><msup><mn>2</mn><mn>30</mn></msup></mrow></semantics></math>1C<230