QOJ.ac

QOJ

Süre Sınırı: 3.5 s Bellek Sınırı: 256 MB Toplam puan: 100

#11553. 因數

İstatistikler

給定一個由 $n$ 個整數 $a_1, a_2, \ldots, a_n$ 組成的序列。你需要求出滿足 $i, j \in \{1, \ldots, n\}$、$i \ne j$ 且 $a_i$ 是 $a_j$ 的因數的有序對 $(i, j)$ 的數量。

輸入格式

輸入第一行包含一個整數 $n$($1 \le n \le 2\,000\,000$)。第二行包含一個由 $n$ 個整數 $a_1, a_2, \ldots, 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.