[BOJ 15616] Divisors
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
2
Time limit:
2.0s
Memory limit:
512M
Problem types
Allowed languages
You are given a sequence of n integers a1, a2, ..., an. You should determine the number of such ordered pairs (i, j), that i, j ∈ {1, ..., n}, i ≠ j and ai is a divisor of aj.
입력 형식
The first line of input contains one integer n (1 ≤ n ≤ 2,000,000). The second line contains a sequence of n integers a1, a2, ..., an (1 ≤ ai ≤ 2,000,000).
출력 형식
In the first and only line of output should contain one integer, denoting the number of pairs sought.
예제 입력
5
2 4 5 2 6
예제 출력
6
힌트
There are 6 pars with the specified properties: (1, 2), (1, 4), (1, 5), (4, 1), (4, 2), (4, 5).
Comments