#C7407. Count Divisors
Count Divisors
Count Divisors
Given a list of integers, compute the number of divisors for each distinct integer in the list. For an integer \(n\), its divisor count \(d(n)\) is defined as the number of positive integers that divide \(n\) without leaving a remainder. For example, \(d(4)=3\) because the divisors of 4 are 1, 2, and 4.
Your task is to read the input from stdin and print the result to stdout in the form of a dictionary-like string. The keys of the dictionary are the integers from the list (in the order of their first occurrence), and the corresponding values are their divisor counts.
For instance, if the input list is [1, 2, 3, 4, 5], the output should be: {1: 1, 2: 2, 3: 2, 4: 3, 5: 2}.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a single integer \(n\) (\(n \ge 0\)) representing the number of elements in the list.
- If \(n > 0\), the second line contains \(n\) space-separated integers.
outputFormat
The output is a single line printed to standard output (stdout). It is a dictionary-like string where each key is a unique number from the input (in order of appearance) and the corresponding value is the number of its divisors. The format should be as follows:
{key1: value1, key2: value2, ...}
If the input list is empty, print {}
(without the quotes).
0
{}