QOJ.ac

QOJ

Limite de temps : 3.5 s Limite de mémoire : 256 MB Points totaux : 100

#11553. 约数

Statistiques

给定一个包含 $n$ 个整数的序列 $a_1, a_2, \dots, a_n$。你需要确定满足以下条件的有序对 $(i, j)$ 的数量:$i, j \in \{1, \dots, n\}$,$i \neq j$,且 $a_i$ 是 $a_j$ 的约数。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 2\,000\,000$)。第二行包含一个长度为 $n$ 的整数序列 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 2\,000\,000$)。

输出格式

输出仅一行,包含一个整数,表示所求的有序对数量。

样例

输入格式 1

5
2 4 5 2 6

输出格式 1

6

说明

有 6 对满足条件的有序对:$(1, 2), (1, 4), (1, 5), (4, 1), (4, 2), (4, 5)$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.