Description

The marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers nk and a sequence of n positive integersa1, a2, ..., an. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also reads like a good criminal.

However I, Heidi, will have none of that. As my joke for today, I am removing the story from the statement and replacing it with these two unhelpful paragraphs. Now solve the problem, fools!

Input

The first line of the input contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 2200). The second line contains n space-separated integers a1, ..., an (1 ≤ ai≤ 104).

Output

Output one number.

Examples
input
8 5
1 1 1 1 1 1 1 1
output
5
input
10 3
16 8 2 4 512 256 32 128 64 1
output
7
input
5 1
20 10 50 30 46
output
10
input
6 6
6 6 6 6 6 6
output
36
input
1 1
100
output
100
题意:额。。。就是选k个数字(从小到大加起来啦)
解法:同上
#include<bits/stdc++.h>
using namespace std;
long long sum;
int t;
int k,n;
int x[];
int main()
{
cin>>n>>k;
for(int i=;i<=n;i++)
{
cin>>x[i];
}
sort(x+,x++n);
for(int i=;i<=k;i++)
{
sum+=x[i];
}
cout<<sum<<endl;
return ;
}

Helvetic Coding Contest 2017 online mirror (teams allowed, unrated) M的更多相关文章

  1. Helvetic Coding Contest 2017 online mirror (teams allowed, unrated)

    G. Fake News (easy) time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. Helvetic Coding Contest 2017 online mirror (teams allowed, unrated) J

    Description Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their comm ...

  3. Helvetic Coding Contest 2017 online mirror (teams allowed, unrated) A

    Description Your search for Heidi is over – you finally found her at a library, dressed up as a huma ...

  4. Helvetic Coding Contest 2019 online mirror (teams allowed, unrated)

    http://codeforces.com/contest/1184 A1 找一对整数,使x^x+2xy+x+1=r 变换成一个分式,保证整除 #include<iostream> #in ...

  5. Helvetic Coding Contest 2018 online mirror (teams allowed, unrated)F3 - Lightsabers (hard)

    题意:n个数字1-m,问取k个组成的set方案数 题解:假设某个数出现k次,那么生成函数为\(1+x+...+x^k\),那么假设第i个数出现ai次,结果就是\(\sum_{i=1}^m(1+x+.. ...

  6. CF 690C3. Brain Network (hard) from Helvetic Coding Contest 2016 online mirror (teams, unrated)

    题目描述 Brain Network (hard) 这个问题就是给出一个不断加边的树,保证每一次加边之后都只有一个连通块(每一次连的点都是之前出现过的),问每一次加边之后树的直径. 算法 每一次增加一 ...

  7. [Helvetic Coding Contest 2017 online mirror]

    来自FallDream的博客,未经允许,请勿转载,谢谢, 第一次在cf上打acm...和同校大佬组队打 总共15题,比较鬼畜,最后勉强过了10题. AB一样的题目,不同数据范围,一起讲吧 你有一个背包 ...

  8. 【Codeforces】Helvetic Coding Contest 2017 online mirror比赛记

    第一次打ACM赛制的团队赛,感觉还行: 好吧主要是切水题: 开场先挑着做五道EASY,他们分给我D题,woc什么玩意,还泊松分布,我连题都读不懂好吗! 果断弃掉了,换了M和J,然后切掉了,看N题: l ...

  9. Helvetic Coding Contest 2016 online mirror A1

    Description Tonight is brain dinner night and all zombies will gather together to scarf down some de ...

随机推荐

  1. C++类中使用new及delete小例子(续)

    在该示例中我们显式定义了复制构造函数来代替默认复制构造函数, 在该复制构造函数的函数体内, 不是再直接将源对象所申请空间的地址赋值给被初始化的对象, 而是自己独立申请一处内存后再将源对象的属性复制过来 ...

  2. Android图表AChartEngine

    很多时候项目中我们需要对一些统计数据进行绘制表格,更多直观查看报表分析结果.基本有以下几种方法: 1:可以进行android api进行draw这样的话,效率比较低 2:使用开源绘表引擎,这样效率比较 ...

  3. NPOI实现Excel导入

    导入功能实现: ]; GetExtensionsFromFileStream(file.InputStream); using NPOI.XSSF.UserModel; public List< ...

  4. 小程序 swiper banner 图片 居中

    var imgUrlApp = getApp().globalData.imgUrlApp; Page({ /** * 页面的初始数据 */ data: { indicatorDots: true, ...

  5. android adapter公共写法

    在开发过程中,会写很多的adapter类,其中很多公共的部分,不需要每次都去书写,可以为开发者省下很多时间 提取一个ListViewAdapter public abstract class List ...

  6. safi 中placeholder不垂直居中

    用css hack将line-height 设置为1 例子: input{height: 32px; line-height: 32px; [;line-height: 1px;]};

  7. HDU2732 Leapin' Lizards —— 最大流、拆点

    题目链接:https://vjudge.net/problem/HDU-2732 Leapin' Lizards Time Limit: 2000/1000 MS (Java/Others)    M ...

  8. linux初级学习笔记一:linux操作系统及常用命令,及如何获取命令的使用帮助!(视频序号:02_1,2)

    本节学习的命令:ls,cd,type,pwd, printenv, hash, date, clock, man, hwclock, info, cal, echo, printf, file! 本节 ...

  9. 一步一步学Silverlight 2系列(22):在Silverlight中如何用JavaScript调用.NET代码

    概述 Silverlight 2 Beta 1版本发布了,无论从Runtime还是Tools都给我们带来了很多的惊喜,如支持框架语言Visual Basic, Visual C#, IronRuby, ...

  10. lucene倒排索引瘦身的一些实验——merge的本质是减少cfx文件 变为pos和doc;存储term vector多了tvx和tvd文件有337M

    store NO 压缩后的原始数据 原始数据大小 索引大小 索引时间 单词搜索时间 266 791 594 176 0.2 文件组成见后 运行forceMerge(3)后 merge的本质是减少cfx ...