Similar Chocolates
Practice
2.6 (17 votes)
Data structures
Easy
Hash maps
Hash tables
Implementation
Problem
63% Success 3102 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

There are $$N$$ chocolates denoted by array $$A$$ where $$A[i]$$ is the length of the $$i$$-th chocolate. Alice can melt each chocolate and then convert it into a chocolate whose length is any divisor of the number $$A[i]$$. So, a chocolate of length $$A[i]$$ can be converted into $$X$$ different types of chocolate where $$X$$ is the count of divisors of the number $$A[i]$$. So you need to count the total unordered pair of chocolates such that their $$X$$ value is same.

Input Format
The first line contains an integer $$N$$ as input denoting the total number of elements in the array $$A$$.
The next line contains $$N$$ space-separated integers that denote the elements of the array $$A$$.

Output Format
In the output, print the total number of ways as mentioned in the statement.

Constraints
$$1 \le N \le 10^5$$
$$1 \le A[i] \le 10^6$$

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
16 votes
Tags:
AlgorithmsData StructuresHash TablesMath
Points:20
368 votes
Tags:
Ad-HocApprovedEasyImplementationReadySorting
Points:20
50 votes
Tags:
ApprovedBasic ProgrammingEasyHash MapsOpen