POJ 2782
#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的更多相关文章
- poj 2782 Bin Packing (贪心+二分)
F - 贪心+ 二分 Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Description ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- POJ 2255. Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11939 Accepted: 7493 De ...
- 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 ...
随机推荐
- ES6展开运算符的3个用法
展开运算符的用法1:传参 // 展开运算符的用法1 : 传参 function test(a,b) { return a + b ; } var arr = [1,2]; console.log(te ...
- scrapy知识积累
Scrapy 中文文档https://scrapy-chs.readthedocs.io/zh_CN/latest/intro/overview.html 创建项目 scrapy startproje ...
- CSS Sprites (CSS 精灵) 技术
CSS Sprites在国内很多人叫css精灵,是一种网页图片应用处理方式.它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来,当访问该页面时,载入的图片就不会像以前那样一幅一幅地慢 ...
- MFC事件和线程
HANDLE WINAPI CreateThread ( __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes, // 指向SECURITY_ATTRIB ...
- kepware http接口 javascript开发
读取某变量的值(jquery var settings = { "async": true, "crossDomain": true, "url&qu ...
- html5之range
第一次以这种方式做笔记,希望可以加强自己对新知识的理解,更希望能得到更多朋友的指正. 言归正传: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 ...
- POJ3255-Roadblocks(最短路)
Description Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best ...
- web-day2
第2章WEB02-CSS&JS篇 今日任务 使用CSS完成网站首页的美化 使用CSS完成网站注册页面的美化 使用JS完成简单的数据校验 使用JS完成图片轮播效果 教学导航 教学目标 了解CSS ...
- 对工程测量大师App的评价
我是测绘工程专业的学生,去年由于同学的推荐我开始使用工程测量大师这款App. 工程测量大师是一款非常方便的测量计算软件,用户将测量的数据输入后,软件就可以帮助你得到精确的计算结果.操作非常简单,使用起 ...
- python的打开_记录
1. 2.7版本,安装了2.7,可以在命令符里面输入cmd,然后输入python,进入python的工作环境. 2. 3.6版本 ,anaconda版本,在F:\qhpython里边找到python. ...