QOJ.ac

QOJ

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

#11553. Ước số

Statistiques

Cho một dãy gồm $n$ số nguyên $a_1, a_2, \ldots, a_n$. Bạn cần xác định số cặp có thứ tự $(i, j)$ sao cho $i, j \in \{1, \ldots, n\}$, $i \ne j$ và $a_i$ là ước của $a_j$.

Dữ liệu vào

Dòng đầu tiên của dữ liệu vào chứa một số nguyên $n$ ($1 \le n \le 2\,000\,000$). Dòng thứ hai chứa một dãy gồm $n$ số nguyên $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 2\,000\,000$).

Dữ liệu ra

Dòng đầu tiên và duy nhất của dữ liệu ra phải chứa một số nguyên biểu thị số cặp cần tìm.

Ví dụ

Dữ liệu vào 1

5
2 4 5 2 6

Dữ liệu ra 1

6

Ghi chú

Có 6 cặp thỏa mãn các tính chất đã nêu: $(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.