#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的更多相关文章

  1. POJ 2590 Steps (ZOJ 1871)

    http://poj.org/problem?id=2590 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1871 题目大 ...

  2. POJ 2590:Steps

    Steps Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7872   Accepted: 3612 Description ...

  3. 上POJ刷题

    Online Judge系统      Online Judge系统(简称OJ)是一个在线的判题系统.用户可以在线提交给定问题的多种程序(如C.C++.Pascal.Java)源代码,系统对源代码进行 ...

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

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

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

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

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

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

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

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

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

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

  9. POJ 2739. Sum of Consecutive Prime Numbers

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

随机推荐

  1. IDEA将项目导出war包方法(详细)

    右上角点击进入配置页面(如图)选择Artifcts 点击绿色的那个+号,选择Web Application:Archive; 设置名称,选择输出路径 下面开始打war包在Build下面选择Build ...

  2. JWT 理解

    概念: JWT是json web token缩写.它将用户信息加密到token里,服务器不保存任何用户信息.服务器通过使用保存的密钥验证token的正确性,只要正确即通过验证. 优点是在分布式系统中, ...

  3. python code(1)

    from collections import UserList class MthChianList(UserList): def filter(self,predicste): return Mt ...

  4. python科学计算模块NumPy

    NumPy是Numerical Python的简称,是高性能科学计算和数据分析的基础包.其实NumPy 本身并并没有提供太多的高级的数据分析功能, 但是理解NumPy数组以及面向数组的计算将有利于你更 ...

  5. js判断软键盘是否开启弹出

    移动端关于页面布局,如果底部有position:fixed的盒子,又有input,当软键盘弹出收起都会影响页面布局.这时候Android可以监听resize事件,代码如下,而ios没有相关事件. va ...

  6. Django开发环境搭建

    最近笔者使用了Django框架作为项目model层的数据对象处理. 关于Django的开发环境,需要安装以下内容: 1.安装python 2.安装VCForPython27.msi 3.安装pycha ...

  7. 进程之multiprocessing

    进程的状态:

  8. POJ3616--Milking Time(动态规划)

    Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that sh ...

  9. 网络timeout区分

    ConnectTimeout 连接建立时间,三次握手完成时间 SocketTimeout 数据传输过程中数据包之间间隔的最大时间 下面重点说下SocketTimeout,比如有如下图所示的http请求 ...

  10. IDHTTP的基本用法

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...