编程题
### 问题描述 给定一个长度为 $n$ 的正整数数列 $a$,求一个最短的区间 $[l, r]$ 满足 $\operatorname{lcm}(a_l, a_{l + 1},\dots,a_r) = \operatorname{lcm}(a_1,a_2,\dots, a_n)$。 你需要输出这个最短的区间的长度。 ### 输入格式 输入第一行,包含一个整数 $n$,表示序列的长度。 输入第二行,包含 $n$ 个数,表示这个序列。 ### 输出格式 输出仅一行,包含一个整数,表示答案。 ### 样例输入 ```text 5 3 3 4 8 4 ``` ### 样例输出 ```text 3 ``` ### 说明 在样例中,这个序列的 $\operatorname{lcm}$ 为 $24$。 对于区间 $[2, 4]$,其 $\operatorname{lcm}$ 也为 $24$。 ### 评测数据规模 对于 $100$% 的评测数据,$1\leq n, a_i\le 10^5$。
查看答案
赣ICP备20007335号-2