#include <iostream>
#include <algorithm>
#define MAXN 100005
using namespace std; int _m[MAXN];
bool op(int a,int b);
int main()
{
//freopen("acm.acm","r",stdin);
int n;
int l;
int i;
int j;
int ans = ;
//cin>>n;
//cin>>l;
scanf("%d",&n);
scanf("%d",&l);
for(i = ; i < n; ++ i)
{
// cin>>_m[i];
scanf("%d",&_m[i]);
}
sort(_m,_m+n,op); j = n-;
for(i = ; i < j;)
{
if(_m[i]+_m[j] <= l)
{
++ ans;
++ i;
-- j;
}
else
{
++ i;
++ ans;
}
}
if(i == j)
{
++ ans;
}
cout<<ans<<endl;
return ;
} bool op(int a,int b)
{
return a > b;
}

POJ 2782的更多相关文章

  1. poj 2782 Bin Packing (贪心+二分)

    F - 贪心+ 二分 Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu   Description ...

  2. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  3. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  4. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  5. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  6. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  7. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  8. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

  9. POJ 2752 Seek the Name, Seek the Fame [kmp]

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17898   Ac ...

随机推荐

  1. poj-2777(区间线段树,求种类数模板)

    题目链接:http://poj.org/problem?id=2777 参考文章:https://blog.csdn.net/heucodesong/article/details/81038360 ...

  2. Le Chapitre VI

    Ah! petit prince, j'ai compris, peu à peu, ainsi, ta petite vie mélancolique. Tu n'avais eu longtemp ...

  3. 检索 COM 类工厂中 CLSID 为 {10021F00-E260-11CF-AE68-00AA004A34D5} 的组件失败,原因是出现以下错误: 80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))。

    ASP.NET利用SQLDMO可以实现在线备份.还原数据库等各种功能. 由于客户的数据库和WEB服务不再同一台服务器,把网站部署在服务器上以后,运行程序,提示如下错误 当使用Interop.SQLDM ...

  4. 【慕课网实战】Spark Streaming实时流处理项目实战笔记十一之铭文升级版

    铭文一级: 第8章 Spark Streaming进阶与案例实战 黑名单过滤 访问日志 ==> DStream20180808,zs20180808,ls20180808,ww ==> ( ...

  5. 20155205 2016-2017-2 《Java程序设计》第1周学习总结

    20155205 2016-2017-2 <Java程序设计>第1周学习总结 教材学习内容总结 第一章 下载了娄老师推介的xmind,试着自己总结了一下. 为了要运行Java程序,必须安装 ...

  6. WordPaster-UEditor1.x整合教程

    版权所有 2009-2017 荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webplug/wordpa ...

  7. leaflet入门(五)API翻译(下)

    L.PointConstructor(函数构造器)Properties(属性)Methods(方法) L.BoundsConstructor(函数构造器)Properties(属性)Methods(方 ...

  8. linux上搭建solr(用tomcat部署)

    环境centos7 及最新版本solr7 1.先在/usr/local下mkdir solr 2.在里面新建一个tomcat目录 3.拷贝已经解压的tomat到/usr/local/solr/tomc ...

  9. 手机开发-Android

    Android 语言.JAVA 开发环境.一是JDKjava开发工具包,二是eclipse开发工具IDE,三是Android SDK安卓软件开发包,四是ADT Android开发工具把JDK和Andr ...

  10. Beta阶段第六篇Scrum冲刺博客-Day5

    1.站立式会议 提供当天站立式会议照片一张 2.每个人的工作 (有work item 的ID),并将其记录在码云项目管理中: 昨天已完成的工作. 张晨晨:完善收藏功能 郭琪容:收藏功能的实现 吴玲:完 ...