atcoder#ABC259E. [ABC259E] LCM on Whiteboard
[ABC259E] LCM on Whiteboard
Score : points
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.
4
1
7 2
2
2 2
5 1
1
5 1
2
2 1
7 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 .
1
1
998244353 1000000000
1
There may be enormous integers on the whiteboard.