#P1408. 互质数列sequence【数据疑似有误】
互质数列sequence【数据疑似有误】
Description
A sequence has numbers. We define an operation: we can divide two adjacent numbers simultaneously by one of their common divisors, and the cost of this operation is the value of that divisor. After performing such operations several times, we can transform the original sequence so that every pair of adjacent numbers is coprime. Find the minimum total cost to achieve this.
Input Format
The first line contains a positive integer . In the next lines, each line contains an integer, representing each number in the sequence in order.
Output Format
Output the minimum cost.
3
3
12
6
5
Hint
- 30% of the testdata satisfies .
- 100% of the testdata satisfies , and the numbers in the sequence satisfy .
Translated by ChatGPT 5
京公网安备 11011102002149号