306475: CF1203C. Common Divisors
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Common Divisors
题意翻译
题目描述: 你有一个由$n$个整数组成的数组,计算这样的正整数$x$的数量,使数组中的每个数字除以$x$余数都为$0$。 换句话说,您必须找到数组中所有元素的公约数的个数。 例如,如果数组$a$为$[2,4,6,2,10]$,则$1$和$2$将每个数字除以数组(因此该示例的答案为$2$)。 输入格式: 输入的第一行包含一个整数$n(1\leq n\leq 4\times 10^5)$,即数组$a$中的元素个数。 输入的第二行包含$n$个整数$a_1$,$a_2$,...,$a_n$($1\leq a_i\leq 10^{12}$),其中$a_i$是数组$a$的第$i$个元素。 输出格式: 输出一个整数,即这样的正整数$x$的数量,使得给定数组中的每个数字除以$x$的余数都为$0$(换句话说,答案是数组中所有元素的公约数的数量)。题目描述
You are given an array $ a $ consisting of $ n $ integers. Your task is to say the number of such positive integers $ x $ such that $ x $ divides each number from the array. In other words, you have to find the number of common divisors of all elements in the array. For example, if the array $ a $ will be $ [2, 4, 6, 2, 10] $ , then $ 1 $ and $ 2 $ divide each number from the array (so the answer for this test is $ 2 $ ).输入输出格式
输入格式
The first line of the input contains one integer $ n $ ( $ 1 \le n \le 4 \cdot 10^5 $ ) — the number of elements in $ a $ . The second line of the input contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 1 \le a_i \le 10^{12} $ ), where $ a_i $ is the $ i $ -th element of $ a $ .
输出格式
Print one integer — the number of such positive integers $ x $ such that $ x $ divides each number from the given array (in other words, the answer is the number of common divisors of all elements in the array).
输入输出样例
输入样例 #1
5
1 2 3 4 5
输出样例 #1
1
输入样例 #2
6
6 90 12 18 30 18
输出样例 #2
4