博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
B. Emotes
阅读量:6421 次
发布时间:2019-06-23

本文共 1944 字,大约阅读时间需要 6 分钟。

There are nn emotes in very popular digital collectible card game (the game is pretty famous so we won't say its name). The ii-th emote increases the opponent's happiness by ai units (we all know that emotes in this game are used to make opponents happy).

You have time to use some emotes only m times. You are allowed to use any emotion once, more than once, or not use it at all. The only restriction is that you cannot use the same emote more than kk times in a row (otherwise the opponent will think that you're trolling him).

Note that two emotes i and j (ij) such that ai=aj are considered different.

You have to make your opponent as happy as possible. Find the maximum possible opponent's happiness.

Input

The first line of the input contains three integers n,mn,m and kk (2n21051km2109) — the number of emotes, the number of times you can use emotes and the maximum number of times you may use the same emote in a row.

The second line of the input contains nn integers a1,a2,,a(1ai109), where aiai is value of the happiness of the ii-th emote.

Output

Print one integer — the maximum opponent's happiness if you use emotes in a way satisfying the problem statement.

Examples
input
Copy
6 9 21 3 3 7 4 2
output
Copy
54
input
Copy
3 1000000000 11000000000 987654321 1000000000
output
Copy
1000000000000000000

 

#include 
using namespace std;long long a[200005];bool cmp(long long a,long long b){ return a>b;}int main(){ long long n,m,k,maxx=0,maxi=0; cin>>n>>m>>k; int i; for(i=0;i
>a[i]; if(a[i]>maxx){ maxi=maxx; maxx=a[i]; } else { if(a[i]>maxi) maxi=a[i]; } }// cout<
<<" "<
<
0;m--){ if(flag

 

 

转载于:https://www.cnblogs.com/shengge-777/p/10398944.html

你可能感兴趣的文章
iOSpush过后返回多级界面
查看>>
[BZOJ1997/HNOI2010]平面图判定
查看>>
tensorflow学习
查看>>
request:通过表单手机客户机数据
查看>>
response发送状态码
查看>>
python-django(框架结构)
查看>>
常用dos命令
查看>>
跨线程调用DataGridView控件
查看>>
input框限制只能输入正整数,逻辑与和或运算
查看>>
【angularJS】定义模块angular.module
查看>>
Windows7+IIS7.5+PHP修改上传文件大小的解决方法
查看>>
java Bean的映射工具
查看>>
无法加载程序集,因为该程序集包含EdmSchemaAttribute,并按名称加载结束类型。不允许同时按名称和特性进行加载...
查看>>
缓存算法
查看>>
Windows 8 动手实验系列教程 实验5:进程生命周期管理
查看>>
Android开发计划
查看>>
application/x-www-form-urlencoded接口响应报文中文乱码
查看>>
SpringMVC 简介及入门案例
查看>>
物联网硬件安全分析基础-硬件分析初探
查看>>
4、javascript中各种提示框的使用
查看>>