303791: CF731F. Video Cards
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Video Cards
题意翻译
$\texttt{Vlad}$ 有一个长度为 $n$ 的数组 $a_i$。 他让你求 $\max\limits_{k=1}^{n}\sum\limits_{i=1}^{n}(a_i-a_i\mod a_k)$. $1\le n,a_i\le 2\times 10^5$题目描述
Little Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named Bota-3. Of course, Vlad immediately bought only to find out his computer is too old for the new game and needs to be updated. There are $ n $ video cards in the shop, the power of the $ i $ -th video card is equal to integer value $ a_{i} $ . As Vlad wants to be sure the new game will work he wants to buy not one, but several video cards and unite their powers using the cutting-edge technology. To use this technology one of the cards is chosen as the leading one and other video cards are attached to it as secondary. For this new technology to work it's required that the power of each of the secondary video cards is divisible by the power of the leading video card. In order to achieve that the power of any secondary video card can be reduced to any integer value less or equal than the current power. However, the power of the leading video card should remain unchanged, i.e. it can't be reduced. Vlad has an infinite amount of money so he can buy any set of video cards. Help him determine which video cards he should buy such that after picking the leading video card and may be reducing some powers of others to make them work together he will get the maximum total value of video power.输入输出格式
输入格式
The first line of the input contains a single integer $ n $ ( $ 1<=n<=200000 $ ) — the number of video cards in the shop. The second line contains $ n $ integers $ a_{1} $ , $ a_{2} $ , ..., $ a_{n} $ ( $ 1<=a_{i}<=200000 $ ) — powers of video cards.
输出格式
The only line of the output should contain one integer value — the maximum possible total power of video cards working together.
输入输出样例
输入样例 #1
4
3 2 15 9
输出样例 #1
27
输入样例 #2
4
8 2 2 7
输出样例 #2
18