(~ ̄▽ ̄)~*

//把最大单独放,然后第二大的和最小的放一起,第三大的和第二小的放一起
//由此类推,求最大值,即为盒的最小值
#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. Java学习笔记-Json

    //先导入gson到lib,add build path //2015年5月5日22:02:37 package com.alfredsun.thread; import com.google.gso ...

  2. 用websocket实现后台推送消息

    1前台实现 connect:function() { var webSocketIP = window.CRM_CONFIG.WebSocketIP; var target = 'ws://'+web ...

  3. mac下 使用 versions版本控制工具 修复游戏bug过程

    1,首先拥有游戏源代码文件,修复bug之前先使用versions工具进行更新: 2,查找指定的bug之前,先运行游戏,在源代码中觉得是bug的地方打个断点,然后运行游戏的对应有bug的地方,看是否会有 ...

  4. visual studio 中将选中代码相同的代码的颜色设置,修改高亮颜色

    这是一个很实用的功能,默认的设置里不是很明显,设置完之后效果图如下: 具体设置方法是: 1. 菜单:工具  -> 选项  ->环境  ->字体和颜色 2. 在右边的 "显示 ...

  5. AsyncHttpClient 中的重定向和 setEnableRedirects 方法异常解决

    今天使用 AsyncHttpClient  开源库,遇到个很崩溃的问题: 方法  setEnableRedirects(false); 从名称上看应该是重定向开关的方法,设置为 false 后则普通请 ...

  6. ios UIImageView异步加载网络图片

    方法1:在UI线程中同步加载网络图片 UIImageView *headview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 4 ...

  7. KMP算法 学习例题 POJ 3461Oulipo

    Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37971   Accepted: 15286 Description The ...

  8. 正确的IP地址正则表达式

    ((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)

  9. wcf测试工具

    WCF测试工具-WcfStorm WCF测试工具-WcfStorm  http://www.wcfstorm.com/wcf/home.aspx WcfStorm is a dead-simple, ...

  10. 谜题 UVA227

    这道题目还是不难的,但是要注意gcc里面gets已经不能用了,用gets_s还是可以的,尽管我并不知道有什么区别 #include<stdio.h>#include<stdlib.h ...