亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

【Codeforces 731 F Video Cards】

2019-11-11 07:24:55
字體:
來源:轉載
供稿:網友

F. Video Cards time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output

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 ai. 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. Input

The first line of the input contains a single integer n (1?≤?n?≤?200?000) — the number of video cards in the shop.

The second line contains n integers a1, a2, …, an (1?≤?ai?≤?200?000) — powers of video cards. Output

The only line of the output should contain one integer value — the maximum possible total power of video cards working together. Examples Input

4 3 2 15 9

Output

27

Input

4 8 2 2 7

Output

18

Note

In the first sample, it would be optimal to buy video cards with powers 3, 15 and 9. The video card with power 3 should be chosen as the leading one and all other video cards will be compatible with it. Thus, the total power would be 3?+?15?+?9?=?27. If he buys all the video cards and pick the one with the power 2 as the leading, the powers of all other video cards should be reduced by 1, thus the total power would be 2?+?2?+?14?+?8?=?26, that is less than 27. Please note, that it’s not allowed to reduce the power of the leading video card, i.e. one can’t get the total power 3?+?1?+?15?+?9?=?28.

In the second sample, the optimal answer is to buy all video cards and pick the one with the power 2 as the leading. The video card with the power 7 needs it power to be reduced down to 6. The total power would be 8?+?2?+?2?+?6?=?18.

以a[i]為leading,a[i] * 2 ~ a[i] * 3 - 1 內的數的貢獻均為 a[i] * 2

AC代碼 :

#include<cstdio>#include<algorithm>using namespace std;const int K = 4e5 + 10;typedef long long LL;LL sum[K],num[K];int main(){ LL N,a,mx = 0,ans = 0; scanf("%lld",&N); for(int i = 1 ; i <= N; i++) scanf("%lld",&a),num[a]++,mx = max(mx,a); for(int i = 1 ; i < K; i++) sum[i] = sum[i - 1] + num[i]; for(int i = 1 ; i <= mx; i++) if(num[i]){ LL cut = 0; for(int j = i ; j <= mx; j += i) cut += (sum[j + i - 1] - sum[j - 1]) * j; ans = max(ans,cut); }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
在线观看91久久久久久| 伊人久久精品视频| 精品久久久久久中文字幕大豆网| 国产成人精品日本亚洲| 奇门遁甲1982国语版免费观看高清| 992tv成人免费视频| 亚洲一区二区国产| 成人天堂噜噜噜| 黄色91在线观看| 色综合视频一区中文字幕| 国产亚洲精品成人av久久ww| 亚洲人成在线电影| 欧美香蕉大胸在线视频观看| 亚洲在线免费看| 国产精品极品尤物在线观看| 国产一区二区三区精品久久久| 国产视频欧美视频| 亚洲精品国产综合久久| 国产成人精品久久二区二区91| 668精品在线视频| 亚洲网站视频福利| 国产精品成久久久久三级| 国产成人激情视频| 狠狠色狠狠色综合日日五| www.日韩欧美| 欧美主播福利视频| 久久久女人电视剧免费播放下载| 国产精品久久久久久av下载红粉| 欧美精品在线观看| 97不卡在线视频| 日本免费一区二区三区视频观看| 亚洲欧美国产制服动漫| 国产剧情日韩欧美| 欧美性生交xxxxxdddd| 日韩高清人体午夜| 高清亚洲成在人网站天堂| 日韩资源在线观看| 国内揄拍国内精品| 欧美亚洲另类视频| 久久久综合免费视频| www.久久草.com| 国产在线视频不卡| 亚洲天堂av在线免费| 日韩av高清不卡| 日韩精品一区二区视频| 欧美日韩中国免费专区在线看| 精品久久中文字幕久久av| 国产亚洲福利一区| 欧美乱大交xxxxx另类电影| 超碰91人人草人人干| www.亚洲一二| 欧美插天视频在线播放| 久久久精品999| 欧美日韩国产精品| 国产成人综合av| 亚洲国产精品热久久| www.国产一区| 日韩在线免费av| 亚洲精品视频免费在线观看| 亚洲欧美在线第一页| 成人a级免费视频| 中文字幕日韩欧美| 久久不射热爱视频精品| 欧美成人中文字幕| 91精品国产沙发| 日本乱人伦a精品| 欧美美最猛性xxxxxx| 91久久精品视频| 国产成人精品视频| 亚洲欧美另类自拍| 国产精品主播视频| 日韩精品欧美国产精品忘忧草| 韩剧1988免费观看全集| 成人精品一区二区三区电影黑人| 91亚洲精品久久久久久久久久久久| 久久亚洲精品中文字幕冲田杏梨| 亚洲欧美激情在线视频| 亚洲最大福利视频| 亚洲区免费影片| 色悠悠国产精品| 一区二区欧美激情| 欧美性一区二区三区| 久久伊人免费视频| 欧美日韩福利在线观看| 97香蕉超级碰碰久久免费的优势| 久久久久久com| 国产精品日韩欧美综合| 在线精品高清中文字幕| 国产一区二区动漫| 亚洲欧美在线第一页| 亚洲综合在线播放| 国模叶桐国产精品一区| 中文字幕国产精品久久| 国产成+人+综合+亚洲欧洲| 国产成人小视频在线观看| 欧美性猛xxx| 亚洲一区中文字幕| 国产精品亚洲一区二区三区| 日韩高清电影免费观看完整| 98精品国产高清在线xxxx天堂| 日本一区二区三区在线播放| 精品视频9999| 久久综合伊人77777尤物| 最近2019中文字幕第三页视频| 国产欧美va欧美va香蕉在线| 日韩欧美亚洲一二三区| 国产va免费精品高清在线| 97人人爽人人喊人人模波多| 原创国产精品91| 精品久久久久久中文字幕大豆网| 欧美日韩第一页| 成人免费淫片aa视频免费| 国产成人在线亚洲欧美| 久久精品国产精品亚洲| 亚洲精品中文字幕av| 亚洲国产精品久久久| 久久久久久久国产精品视频| 国产男女猛烈无遮挡91| 久久中文字幕国产| 日韩av123| 成人两性免费视频| 久久久久久国产精品三级玉女聊斋| 亚洲精品国精品久久99热| 中文字幕精品av| 欧美性猛交xxxx免费看| 欧美极品少妇与黑人| 国产91久久婷婷一区二区| 九九久久久久99精品| 国产噜噜噜噜噜久久久久久久久| 成人午夜一级二级三级| 亚洲欧洲激情在线| 久久影视电视剧免费网站清宫辞电视| 欧美成人亚洲成人日韩成人| 亚洲精品影视在线观看| 深夜成人在线观看| 国产精品成av人在线视午夜片| 亚洲国产精品久久久久秋霞蜜臀| 亚洲精品自产拍| 97视频在线观看免费高清完整版在线观看| 欧美裸体男粗大视频在线观看| 欧美日韩亚洲精品一区二区三区| 欧美一级淫片aaaaaaa视频| 日韩欧美一区二区三区| 福利一区福利二区微拍刺激| 亚洲激情国产精品| 精品国产一区二区三区久久久狼| 3344国产精品免费看| 在线日韩第一页| 久久人人爽国产| 精品日本美女福利在线观看| 久久国产精品偷| 欧美高清第一页| 青青久久av北条麻妃黑人| 色哟哟亚洲精品一区二区| 国产精品福利网站| 狠狠色狠狠色综合日日五| 国产性色av一区二区| 久久伊人精品天天| 日韩欧美中文在线| 日韩视频免费中文字幕| 亚洲国产精品久久久久久| 国产精品视频一区二区三区四| 日韩精品中文在线观看| www.99久久热国产日韩欧美.com|