#P1102. A-B 数对

    ID: 102 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>模拟数学二分排序哈希,HASH双指针,尺取法,two-pointer

A-B 数对

Description

Given a sequence of positive integers and a positive integer CC, compute the number of pairs (A,B)(A, B) such that AB=CA - B = C. Pairs with the same values at different positions are considered distinct.

Input Format

The input consists of two lines.

The first line contains two positive integers N,CN, C.

The second line contains NN positive integers, which form the sequence to be processed.

Output Format

Output one line containing the number of pairs in the sequence that satisfy AB=CA - B = C.

4 1
1 1 2 3

3

Hint

Constraints:

  • For 75%75\% of the testdata, 1N20001 \leq N \leq 2000.
  • For 100%100\% of the testdata, 1N2×1051 \leq N \leq 2 \times 10^5, 0ai<2300 \leq a_i < 2^{30}, 1C<2301 \leq C < 2^{30}.

Two new testdata sets were added on 2017/4/29.

Translated by ChatGPT 5