描述When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc..

One day Teddy met a old man in his dream , in that dream the man whose name was“RuLai” gave Teddy a problem :

Given an N , can you calculate how many ways to write N as i * j + i + j (0 < i <= j) ?

Teddy found the answer when N was less than 10…but if N get bigger , he found it was too difficult for him to solve.
Well , you clever ACMers ,could you help little Teddy to solve this problem and let him have a good dream ?

 
输入
The first line contain a T(T <= 2000) . followed by T lines ,each line contain an integer N (0<=N <= 10^11).
输出
For each case, output the number of ways in one line
样例输入
2
1
3
样例输出
0
1
 import java.util.Scanner;

 public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int T;
int number;
int i;
int count; T=scanner.nextInt();
while(true){
if(T==0)
break;
T--; number=scanner.nextInt(); count=0;
number++;
for(i=2;i*i<=number;i++){
if(number%i==0)
count++;
}
System.out.println(count);
}
}
}
 

A problem is easy的更多相关文章

  1. ACM A problem is easy

    A problem is easy 时间限制:1000 ms  |  内存限制:65535 KB 难度:3   描述 When Teddy was a child , he was always th ...

  2. [原]NYOJ-216-A problem is easy

    大学生程序代写 /*A problem is easy 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 When Teddy was a child , he was a ...

  3. nyoj 216-A problem is easy ((i + 1) * (j + 1) = N + 1)

    216-A problem is easy 内存限制:64MB 时间限制:1000ms 特判: No 通过数:13 提交数:60 难度:3 题目描述: When Teddy was a child , ...

  4. 1. A + B Problem【easy】

    Write a function that add two numbers A and B. You should not use + or any arithmetic operators. Not ...

  5. UVA-11991 Easy Problem from Rujia Liu?

    Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for ...

  6. [UVA] 11991 - Easy Problem from Rujia Liu? [STL应用]

    11991 - Easy Problem from Rujia Liu? Time limit: 1.000 seconds Problem E Easy Problem from Rujia Liu ...

  7. codeforces A. In Search of an Easy Problem

    A. In Search of an Easy Problem time limit per test 1 second memory limit per test 256 megabytes inp ...

  8. 2016弱校联盟十一专场10.5---As Easy As Possible(倍增)

    题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8506#problem/A problem description As we know, t ...

  9. Gym 100851E Easy Problemset (模拟题)

    Problem E. Easy ProblemsetInput file: easy.in Output file: easy.outPerhaps one of the hardest problems ...

随机推荐

  1. MYSQL数据库性能调优之八:mysql日志

    MySQL日志 主要包含:错误日志.查询日志.慢查询日志.事务日志.二进制日志.中继日志: 使用 SHOW GLOBAL VARIABLES LIKE '%log%';  查询所有日志配置详情: 一. ...

  2. GPIO 配置之ODR, BSRR, BRR 详解

    STM32 GPIO 配置之ODR, BSRR, BRR 详解 用stm32 的配置GPIO 来控制LED 显示状态,可用ODR,BSRR,BRR 直接来控制引脚输出状态. ODR寄存器可读可写:既能 ...

  3. CCF 201312-1 出现次数最多的数 (水题)

    问题描述 给定n个正整数,找出它们中出现次数最多的数.如果这样的数有多个,请输出其中最小的一个. 输入格式 输入的第一行只有一个正整数n(1 ≤ n ≤ 1000),表示数字的个数. 输入的第二行有n ...

  4. CodeForces 710C Magic Odd Square (n阶奇幻方)

    题意:给它定一个n,让你输出一个n*n的矩阵,使得整个矩阵,每行,每列,对角线和都是奇数. 析:这个题可以用n阶奇幻方来解决,当然也可以不用,如果不懂,请看:http://www.cnblogs.co ...

  5. Unable to load dll 的解决方案

    前几天在做项目时,需要用到一个非托管的 dll 库,其实使用 .Net 的互操作技术可以很方便地调用非托管 dll 文件中的函数,但是在执行时出现了“Unable to load dll HRESUL ...

  6. mysql无法启动 mysqld process already exists

    1.提示:A mysqld process already exists ps 命令用于查看当前正在运行的进程. grep 是搜索 例如: ps -ef | grep mysql 表示查看所有进程里 ...

  7. UI:tomcat(说话小程序)、相框动画、UISgmentcontrol、UISwitch

    UISegmentedControl 分段控件 //1. UISegmentedControl 分段控件 (就是一个一个的按钮) //分段显示的标题是以一个数组存储的 NSArray * titles ...

  8. OC: Block回调的使用demo

    Block 的用法 对于类的继承问题,子类在实现的时候,一般是自下而上,先看看下面的实现没有,没实现就向上找方法去实现. // // main.m #import <Foundation/Fou ...

  9. ActiveMQ集成到Spring

    [http://wentao365.iteye.com/blog/1560934] spring配置文件applicationContext.xml <?xml version="1. ...

  10. chart.js接口开发:X轴步长和Labels旋转角

    一. 当初为什么选择chart.js 当初项目使用库是Zepto,Zepto能支持的chart处理库太少.也是为了使得项目比较轻量化,所以选择了chart.js. 但是最后的显示结果实在太差,放弃了c ...