luogu#P1102. A-B 数对

    ID: 5160 Type: RemoteJudge 1000ms 125MiB Tried: 224 Accepted: 56 Difficulty: 3 Uploaded By: Tags>模拟数论数学排序二分查找哈希HASH概率论统计

A-B 数对

Problem 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