#abc259e. E - LCM on Whiteboard
E - LCM on Whiteboard
Score : points
问题描述
在一块白板上有 个整数 。
这里,每个整数 可以表示为 $a_i = p_{i,1}^{e_{i,1}} \times \ldots \times p_{i,m_i}^{e_{i,m_i}}$,其中使用了 个素数 和正整数 。
你将从这 个整数中选择一个替换成 。求替换后 个整数的最小公倍数可能取到的不同数值个数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are integers written on a whiteboard.
Here, can be represented as $a_i = p_{i,1}^{e_{i,1}} \times \ldots \times p_{i,m_i}^{e_{i,m_i}}$ using prime numbers and positive integers .
You will choose one of the integers to replace it with .
Find the number of values that can be the least common multiple of the integers after the replacement.
Constraints
- is prime.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
1
7 2
2
2 2
5 1
1
5 1
2
2 1
7 1
Sample Output 1
3
The integers on the whiteboard are $a_1 =7^2=49, a_2=2^2 \times 5^1 = 20, a_3 = 5^1 = 5, a_4=2^1 \times 7^1 = 14$.
If you replace with , the integers on the whiteboard become , whose least common multiple is .
If you replace with , the integers on the whiteboard become , whose least common multiple is .
If you replace with , the integers on the whiteboard become , whose least common multiple is .
If you replace with , the integers on the whiteboard become , whose least common multiple is .
Therefore, the least common multiple of the integers after the replacement can be , , or , so the answer is .
Sample Input 2
1
1
998244353 1000000000
Sample Output 2
1
There may be enormous integers on the whiteboard.
update @ 2024/3/10 10:59:50