QOJ.ac

QOJ

時間限制: 3.5 s 記憶體限制: 256 MB 總分: 100

#11553. 因數

统计

畀你一個由 $n$ 個整數 $a_1, a_2, \ldots, a_n$ 組成嘅序列。你要搵出有幾多個有序對 $(i, j)$ 滿足 $i, j \in \{1, \ldots, n\}$、$i \ne j$,而且 $a_i$ 係 $a_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.