time limit per test 2 seconds

memory limit per test 256 megabytes

input standard input

output standard output

Luba has to do n chores today. i-th chore takes ai units of time to complete. It is guaranteed that for every the conditionai ≥ ai - 1 is met, so the sequence is sorted.

Also Luba can work really hard on some chores. She can choose not more than k any chores and do each of them in x units of time instead of ai ().

Luba is very responsible, so she has to do all n chores, and now she wants to know the minimum time she needs to do everything. Luba cannot do two chores simultaneously.

Input

The first line contains three integers n, k, x (1 ≤ k ≤ n ≤ 100, 1 ≤ x ≤ 99) — the number of chores Luba has to do, the number of chores she can do in x units of time, and the number x itself.

The second line contains n integer numbers ai (2 ≤ ai ≤ 100) — the time Luba has to spend to do i-th chore.

It is guaranteed that , and for each ai ≥ ai - 1.

Output

Print one number — minimum time Luba needs to do all n chores.

Examples

input

4 2 2
3 6 7 10

output

13

input

5 2 1
100 100 100 100 100

output

302

Note

In the first example the best option would be to do the third and the fourth chore, spending x = 2 time on each instead of a3 and a4, respectively. Then the answer is 3 + 6 + 2 + 2 = 13.

In the second example Luba can choose any two chores to spend x time on them instead of ai. So the answer is 100·3 + 2·1 = 302.

题解:

     ①Implentation直接做就是了

#include<stdio.h>
#define go(i,a,b) for(int i=a;i<=b;i++)
int n,k,x,a[],sum;
int main()
{
scanf("%d%d%d",&n,&k,&x);
go(i,,n)scanf("%d",a+i);
go(i,,n-k)sum+=a[i];
printf("%d\n",sum+k*x);return ;
}//Paul_Guderian

.

【CF edu 30 A. Chores】的更多相关文章

  1. 【CF edu 30 D. Merge Sort】

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  2. 【CF edu 30 C. Strange Game On Matrix】

    time limit per test 1 second memory limit per test  256 megabytes input standard input output standa ...

  3. 【Cf edu 30 B. Balanced Substring】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  4. 【CF contest/792/problem/E】

    E. Colored Balls time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  5. 【CF Round 434 A. k-rounding】

    Time limit per test1 second memory limit per test 256 megabytes input standard input output standard ...

  6. 【CF Round 429 B. Godsend】

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  7. 【CF Manthan, Codefest 17 B】Marvolo Gaunt's Ring

    [链接]h在这里写链接 [题意] 给你n个数字; 让你在其中找出三个数字i,j,k(i<=j<=k); 使得p*a[i]+q*a[j]+r*a[k]最大; [题解] /*     有一个要 ...

  8. 【CF Manthan, Codefest 17 A】Tom Riddle's Diary

    [链接]h在这里写链接 [题意] 在这里写题意 [题解] /* Be careful. 二重循环枚举 */ [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/st ...

  9. 【CF 676B Pyramid of Glasses】模拟,递归

    题目链接:http://codeforces.com/problemset/problem/676/B 题意:一个n层的平面酒杯金字塔,如图,每个杯子的容量相同.现在往最顶部的一个杯子倒 t 杯酒,求 ...

随机推荐

  1. hadoop生态搭建(3节点)-05.mysql配置_单节点

    # ==================================================================node1 # ======================== ...

  2. Source Insight的使用

    1. source insight查看函数的上一级调用的位置(函数) --> 鼠标放在函数上,右键 选择 Jump To caller,就可以看到有哪些函数调用它了:

  3. Redis Handle

    package com.jn.baseservice.utils; import com.jn.baseservice.GlobalEntiy.Entity; import com.google.gs ...

  4. MVC4+EF 列表数据不能绑定

    最新准备使用.net 的mvc+Ef来写个项目,开始一切顺利,到了数据绑定时出现了问题. 我的mvc视图引擎是Razor,后台提取数据的是Linq来处理,发现不管怎么样都不能绑定列表数据,可以将后台的 ...

  5. set<pair<int,int> > 的运用

    In this cafeteria, the N tables are all ordered in one line, where table number 1 is the closest to ...

  6. lnmp操作

    LNMP 1.2+状态管理: lnmp {start|stop|reload|restart|kill|status}LNMP 1.2+各个程序状态管理: lnmp {nginx|mysql|mari ...

  7. 史上最全的PHP正则表达式

    首先看下正则表达式思维导图: 一.校验数字的表达式  1 数字:^[0-9]*$2 n位的数字:^\d{n}$3 至少n位的数字:^\d{n,}$4 m-n位的数字:^\d{m,n}$5 零和非零开头 ...

  8. webpack实践总结

    一.Loader写法及执行顺序 从webpack2起,loader的格式如下: module: { rules: [ {test: /\.css$/, use: ['style-loader','cs ...

  9. js 操作表格行数的删减

    沉溺了好几个月了,自从年假回来就一直在忙换工作的事情: 新环境.新同事,一如既往的工作, 那么闲话不多说,前两天师妹问我要一个类似于添加和删除的demo:闲暇时间我就参照一些代码写了一下, (发现有错 ...

  10. 「日常训练」Phone Numbers (CFR466D2C)

    题意(Codeforces 940C) 给定一字符串,求比它字典序大的字符串.限定其长度,并且只能用原串的字母. 分析 考虑原串长度lorigin与给定的长度lgiven.若给定长度大于原串长度,直接 ...