#include<iostream>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<algorithm>
#define FOR for
#define M 10009
using namespace std;
int main()
{
//freopen("acm.acm","r",stdin);
unsigned sum;
unsigned num;
unsigned ans;
unsigned pos;
unsigned pos1;
int time;
int tem;
int i;
cin>>time;
while(time --)
{
ans = 0;
cin>>tem>>num;
for(i = 1; i < sqrt(long double(num*2)); ++ i)
{
if((2 * num % i == 0) && (i + 2 * num / i) % 2 != 0)
{
++ ans;
}
}
cout<<tem<<" "<<--ans<<endl;
}
} /*
需求出这个不定方程的解数即可。显然2 * i + j - 1 > j,于是j < sqrt(2 * n),
方程有解的条件是(2 * n % j == 0) && (j + 2 * n / j) % 2 != 0 有多少个j满足条件就有多少个解,编程实现就很简单了
*/

POJ 2853的更多相关文章

  1. POJ 2853 Sequence Sum Possibilities

    Sequence Sum Possibilities Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5537   Accep ...

  2. Poj 2853,2140 Sequence Sum Possibilities(因式分解)

    一.Description Most positive integers may be written as a sum of a sequence of at least two consecuti ...

  3. 【转载】图论 500题——主要为hdu/poj/zoj

    转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...

  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. 证明解析函数u=c1 与 v=c2 正交

    方程u(x,y)=c1对应平面上的曲线, 求导dy/dx=  -ux/uy   类似有v曲线的dy/dx=-vx/vy   两者相乘,使用柯西-黎曼方程结果是-1 表示在相交点两者的切线互相垂直. 另 ...

  2. Java,数据库中的数据导入到Excel

    private static void executeMethod(JobExecutionContext arg0) throws Exception{ try { TContrastService ...

  3. 多表更新时碰到的 ERROR 1292 (22007)隐式转换错误

    表结构如下: Create Table: CREATE TABLE `test_t2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `customer_no` va ...

  4. [转]两表join的multi update语句在MySQL中的执行流程分析

    出自:http://hedengcheng.com/?p=209 两表join的multi update语句,执行结果与预计不一致的分析过程 — multi update结论在实际应用中,不要轻易使用 ...

  5. Kafka错误“Network is unreachable”和“larger than available brokers”

    确定Kafka安装和启动正确,ZooKeeper可以查到所有的Brokers,但执行: kafka-topics.sh --create --zookeeper localhost:2181 --re ...

  6. 7-12 How Long Does It Take

    Given the relations of all the activities of a project, you are supposed to find the earliest comple ...

  7. DOS下如何打开程序

    cd c:    #先切回主盘,因为最开始在C:\Users\Administrator这个目录下 cd “指定文件所在的盘:”      #切换到文件所在盘 print "文件目录&quo ...

  8. kepware http接口 c语言 python

    读取某变量的值(http.client import http.client conn = http.client.HTTPConnection("127,0,0,1") head ...

  9. Visual Studio 简单使用常识操作

    Visual Studio 简单使用个人总结   转载请注明来源:www.cnblogs.com/icmzn(后续会持续更新) 可以查看一下链接,官方关于visual studio 2010 的介绍  ...

  10. verilog选择数据类型时常犯的错误

    •    信号可以分为端口信号和内部信号.出现在端口列表中的信号是端口信号,其它的信号为内部信号. •    对于端口信号,输入端口只能是net类型.输出端口可以是net类型,也可以是register ...