(~ ̄▽ ̄)~*

//把最大单独放,然后第二大的和最小的放一起,第三大的和第二小的放一起
//由此类推,求最大值,即为盒的最小值
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<cstdlib>
#include<vector>
#include<stack>
#include<map>
using namespace std;
typedef long long ll; const int MAXN=100010;
const int INF=1000001;
int cow[MAXN]; int main()
{
int n,k;
scanf("%d%d",&n,&k);
for(int i=0;i<n;i++)
scanf("%d",&cow[i]);
int minn=cow[n-1];
for(int i=0;i<n-k;i++)
minn=max(minn,cow[i]+cow[(n-k)*2-i-1]);
printf("%d\n",minn);
return 0;
}

CF 604B More Cowbell#贪心的更多相关文章

  1. CF 115B Lawnmower(贪心)

    题目链接: 传送门 Lawnmower time limit per test:2 second     memory limit per test:256 megabytes Description ...

  2. CF Soldier and Badges (贪心)

    Soldier and Badges time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  3. CF Anya and Ghosts (贪心)

    Anya and Ghosts time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  4. codeforces 604B More Cowbell

    题目链接:http://codeforces.com/contest/604/problem/B 题意:n个数字,k个盒子,把n个数放入k个盒子中,每个盒子最多只能放两个数字,问盒子容量的最小值是多少 ...

  5. cf 853 A planning [贪心]

    题面: 传送门 思路: 一眼看得,这是贪心[雾] 实际上,我们要求的答案就是sigma(ci*(ti-i))(i=1~n),这其中sigma(ci*i)是确定的 那么我们就要最小化sigma(ci*t ...

  6. CF 1082E Increasing Frequency(贪心)

    传送门 解题思路 贪心.对于一段区间中,可以将这段区间中相同的元素同时变成\(c\),但要付出的代价是区间中等于\(c\)的数的个数,设\(sum[i]\)表示等于\(c\)数字的前缀和,Max[i] ...

  7. cf 12C Fruits(贪心【简单数学】)

    题意: m个水果,n个价格.每种水果只有一个价格. 问如果给每种水果分配价格,使得买的m个水果总价格最小.最大. 输出最小值和最大值. 思路: 贪心. 代码: bool cmp(int a,int b ...

  8. CF 161B Discounts(贪心)

    题目链接: 传送门 Discounts time limit per test:3 second     memory limit per test:256 megabytes Description ...

  9. CF 268E Playlist(贪心)

    题目链接: 传送门 Playlist time limit per test:1 second     memory limit per test:256 megabytes Description ...

随机推荐

  1. C++ 处理 utf-8

    类似"abc汉字"这样的字符串是以utf-8编码; C++ 的 cout执行的操作是把参数发送给stdout,因此如果终端支持utf-8, 汉字可以使用cout打印: 比较好的办法 ...

  2. android两种方式获取AsyncTask返回值

    获取AsyncTask返回值,在Activity中使用. 引用链接:https://www.oschina.net/code/snippet_725438_49858#72630 [1].[代码] [ ...

  3. iOS NSNotificationCenter 移除通知带来的crash

    Where to remove observer for NSNotification? 在dealloc方法中移除通知观察者带来crash NSNotificationCenter中的通知消息已经发 ...

  4. 利用python3.5 构建流媒体后台音视频切换的服务端程序

    #!/usr/bin/env python3.5.0 # -*- coding:utf8 -*- import os,sys,socket,hashlib,time,select,threading, ...

  5. Tarjan算法详解

    Tarjan算法详解 今天偶然发现了这个算法,看了好久,终于明白了一些表层的知识....在这里和大家分享一下... Tarjan算法是一个求解极大强联通子图的算法,相信这些东西大家都在网络上百度过了, ...

  6. QTREE - Query on a tree

    QTREE - Query on a tree 题目链接:http://www.spoj.com/problems/QTREE/ 参考博客:http://blog.sina.com.cn/s/blog ...

  7. python中判断语句用两个or连接的奇葩

    学python的时候犯的一个错误,放在这吧.就是在循环某个列表的时候不要去操作它,这是容易忽略的一个地方.所以如果要操作某个列表本身,那么先把该列表copy一份,然后再读取的时候读copy的那份.操作 ...

  8. [河南省ACM省赛-第三届] 房间安排 (nyoj 168)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 #include<iostream> ...

  9. c#发送http请求注意

    这里要注意几个点:第一就是编码,如果编码不对,容易中文乱码第二就是ContentType 如果设置不对,有可能连方法都调试不进去(我api用的是MVC的普通controller)第三就是paramDa ...

  10. 制作jar包

    1.打开cmd 2.通过cd切换到要打包的工程所在的bin目录(一定是bin目录) 运行jar -cvf aa.jar *.* jar是打包的命令 -cvf可以自行查看一下文档解释(jar -help ...