暮雪少年与棒棒糖
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Background
After winning a silver medal, Snowy enrolled at Peking University. As he strolled happily along a tree-lined path, he recalled a problem he had yet to solve.
Problem Description
Snowy has candies. The deliciousness of the -th candy is represented by an integer .
A lollipop is formed by combining a contiguous sequence of candies. That is, Snowy chooses indices and () and uses all candies from index to to make one lollipop.
The deliciousness of a single lollipop is defined as the Least Common Multiple (LCM) of the deliciousness values of all candies contained in it.
Snowy wants to partition all candies into an arbitrary number of lollipops. Every candy must belong to exactly one lollipop.
Formally, he needs to select partition points to create lollipops corresponding to the intervals $[1, r_1], [r_1 + 1, r_2], \cdots, [r_{k-1} + 1, r_k]$.
Find a partition strategy such that the sum of the deliciousness of all lollipops is maximized.
It is guaranteed that the answer will not exceed .
Input Format
The first line contains a single integer . The second line contains integers .
Output Format
Output a single integer representing the maximum possible total deliciousness.
Examples
Input 1
3
6 10 15
Output 1
45
Input 2
2
2 3
Output 2
6
Input 3
2
3 6
Output 3
9
Constraints
For of the data, and .
This problem has 25 test points divided into 8 subtasks. You must pass all test points in a subtask to receive points for it.
| Test Points | Special Property | Score | ||
|---|---|---|---|---|
| None | 8 | |||
| 12 | ||||
| A | 4 | |||
| None | 16 | |||
| 20 | ||||
| 8 | ||||
| B | 12 | |||
| None | 20 |
Special Property A: .
Special Property B: For any , is either equal to or is coprime (gcd is 1) to it.
【XJS-C5-Div3】XJSOI 春节大月赛 Round 3 & 勰码可达鸭合作赛 Round 1
- 状态
- 已结束
- 规则
- IOI
- 题目
- 5
- 开始于
- 2026-2-14 0:00
- 结束于
- 2026-2-17 0:00
- 持续时间
- 4 小时
- 主持人
- 参赛人数
- 7