#P5502. [JSOI2015] 最大公约数
[JSOI2015] 最大公约数
Description
Given a sequence of positive integers of length .
For any consecutive subsequence , define its weight as the product of its length and the greatest common divisor of all elements in the subsequence, i.e., .
JYY wants to find the subsequence with the maximum weight.
Input Format
The input contains one line with a positive integer .
The next line contains positive integers, representing the sequence .
Output Format
Output one line with a positive integer, representing the maximum weight among all subsequences.
5
30 60 20 20 20
80
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号