cf552 G Minimum Possible LCMn个数,求最小得一对lcm
?
You are given an array?a?consisting of?n?integers?a1,a2,…,an
Your problem is to find such pair of indices?i,j? (1≤i<j≤n ) that?lcm(ai,aj) is minimum possible.
lcm(x,y)? is the least common multiple of?x?and?y?(minimum positive number such that both? x?and? y?are divisors of this number).
Input
The first line of the input contains one integer? n?(2≤n≤106 ) — the number of elements in?a .
The second line of the input contains?nn?integers?a1,a2,…,an (1≤ai≤107 ), where?ai? is the? i-th element of?a .
Output
Print two integers? i?and? j?(1≤i<j≤n ) such that the value of?lcm(ai,aj) is minimum among all valid pairs?i,j? If there are multiple answers, you can print any.
5
2 4 8 3 6
1 2
5
5 2 11 3 7
2 4
6
2 5 10 1 10 2
1 4
優美的暴力
?
總結
以上是生活随笔為你收集整理的cf552 G Minimum Possible LCMn个数,求最小得一对lcm的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 平方剩余(二次剩余)
- 下一篇: Leetcode记录