POJ 2590
#include<iostream>
#include<algorithm>
#define MAXN 1000000
using namespace std; unsigned a[MAXN]; int main()
{
//freopen("acm.acm","r",stdin);
int i;
int num = ;
int time = ;
int x;
int y;
a[] = ;
for(i = ; i < MAXN; ++ i)
{
a[i] = a[i-] + num;
++ time;
if(time == )
{
++ num;
time = ;
}
}
cin>>num;
while(num --)
{
cin>>x>>y;
cout<<lower_bound(a,a+MAXN,abs(y-x))-a<<endl;
}
}
POJ 2590的更多相关文章
- POJ 2590 Steps (ZOJ 1871)
http://poj.org/problem?id=2590 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1871 题目大 ...
- POJ 2590:Steps
Steps Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7872 Accepted: 3612 Description ...
- 上POJ刷题
Online Judge系统 Online Judge系统(简称OJ)是一个在线的判题系统.用户可以在线提交给定问题的多种程序(如C.C++.Pascal.Java)源代码,系统对源代码进行 ...
- 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 ...
随机推荐
- Altera PLL应用中注意的问题
无论是差分转单端信号还是单端信号转差分信号,都要都要用到altiobuf.而且在pin planner中要设置管脚的标准为差分的 而且要注意管脚的正负极性. 今天用FPGA做测试:把专门用于PLL的输 ...
- 使用函数的列 group by 分组需要别名
问题描述 使用如下截图的SQL统计数据,报1105错误,提示all columns in group by clause should be in the selected column. 给格式化 ...
- 几种修改Linux主机名的方法
在安装一些系统时,需要修改hostname,比如安装Hadoop时需要修改主机名,而且主机名不能包含下划线. 实际上,主机名分三种(命令hostnamectl或hostnamectl status可查 ...
- Hadoop-2.8.0分布式安装手册
目录 目录 1 1. 前言 3 2. 特性介绍 3 3. 部署 5 3.1. 机器列表 5 3.2. 主机名 5 3.2.1. 临时修改主机名 6 3.2.2. 永久修改主机名 6 3.3. 免密码登 ...
- JavaScript常用事件参考
onabort 图像加载被中断 onblur 元素失去焦点 onchange 用户改变域的内容 onclick 鼠标点击某个对象 ondblclick 鼠标双击某个对象 onerror 当加载文档 ...
- jenkins+maven+svn构建项目,及远程部署war包到tomcat上
要使用jenkins构建项目,当然要使用jenkins了,我使用的war版本的jenkins jenkins的官网 http://jenkins-ci.org/ 点击latest下载,但是可能因为天朝 ...
- tarjan算法的补充POJ2533tarjan求度
做题时又遇到了疑惑,说明一开始就没有完全理解 基于dfs的tarjan,搜索时会有四种边 树枝边:DFS 时经过的边,即 DFS 搜索树上的边 前向边:与 DFS 方向一致,从某个结点指向其某个子孙的 ...
- linux创建、进入、修改目录或者文件权限 ‘ACM’时间是什么?怎么修改?
cd code 进入code目录,mkdir test 创建test目录,看代码框都输第三行d(目录文件标识符) rwx(user可读可写可执行) rwx(group可读可写可执行) r-x(othe ...
- php+sqlserver之如何操作sqlserver数据库
https://blog.csdn.net/xia13100004562/article/details/58598872 2016年12月19日 17:15:39 阅读数:6790 前面已经基本配置 ...
- EntityFramework Core 学习扫盲
0. 写在前面 1. 建立运行环境 2. 添加实体和映射数据库 1. 准备工作 2. Data Annotations 3. Fluent Api 3. 包含和排除实体类型 1. Data Annot ...