#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. RabbitMQ c#版实现(转)

    出处:https://www.cnblogs.com/hanfan/p/9842301.html 网上很多人已经总结的很好了,比如今天看到的这个.https://www.cnblogs.com/Lip ...

  2. 使用docker 安装 GITLIB

    在安装 gitlib 社区版时,配置老不成功,改成使用docker安装 比较顺利,省事. 1外部卷配置 docker 需要配置一些卷在外部,创建一下git的目录 我们创建一个在home下 创建一个gi ...

  3. pipenv知识积累

    pip install pipenv 安装pipenv pipenv --python 3.6 指定某一Python版本创建环境 pipenv --py 显示Python解释器信息 pipenv -- ...

  4. s5-15 开放的最短路径优先_OSPF

    L-S路由协议的实例—OSPF 开放的路径优先(Open Shortest Path First) 使用图(graph)来表述真实的网络 - 每个路由器/Lan都是一个节点 - 测量代价/量度(met ...

  5. 如何在MYSQL下所有指定数据库名下执行SQL

    mysql下用户库比较多,都有统一的命名格式,希望在这些所有用户库执行脚本,更新数据,或者查询数据 可以采用以下存储过程实现 DROP PROCEDURE IF EXISTS `sp_execalld ...

  6. es5数组的新方法

    1.every方法 //逻辑判断返回值为一个Boolean值 every方法就是每一个返回函数的返回值都是true的时候,才为true,否则为false var arr=[1,2,5,88,5,555 ...

  7. 第11章:MongoDB-CRUD操作--文档--查询

    ①语法 db.collection.find(query, projection) ②参数 query :可选,使用查询操作符指定查询条件 projection :可选,使用投影操作符指定返回的键.查 ...

  8. 2.3.4volatile的原子性

    关键字volatile虽然增加了实例变量在多个线程之间的可见性,但它却不具备同步性,那么也不具备原子性. 测试 package com.cky.thread; /** * Created by edi ...

  9. XCode中常用错误解决

    No such file or directory     解决方法(可以依次尝试,总有一种能最终解决问题):          方法1.退出Xcode,然后从finder里面进入~/Library/ ...

  10. CentOS 6 安装Redmine

    Redmine是一个灵活的项目管理web应用,采用Ruby on Rails框架开发.Redmine是典型的web 2.0网站,项目管理系统的后起之秀.Redmine支持多项目,灵活的角色权限管理,灵 ...