A problem is easy
描述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
1import 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的更多相关文章
- ACM A problem is easy
A problem is easy 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 When Teddy was a child , he was always th ...
- [原]NYOJ-216-A problem is easy
大学生程序代写 /*A problem is easy 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 When Teddy was a child , he was a ...
- 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 , ...
- 1. A + B Problem【easy】
Write a function that add two numbers A and B. You should not use + or any arithmetic operators. Not ...
- UVA-11991 Easy Problem from Rujia Liu?
Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for ...
- [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 ...
- 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 ...
- 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 ...
- Gym 100851E Easy Problemset (模拟题)
Problem E. Easy ProblemsetInput file: easy.in Output file: easy.outPerhaps one of the hardest problems ...
随机推荐
- Python使用UUID库生成唯一ID(转)
原文:http://www.cnblogs.com/dkblog/archive/2011/10/10/2205200.html 资料: Python官方Doc:<20.15. uuid — U ...
- Java反射机制(取得类的结构)
通过反射得到一个类中的完整的结构,就要使用java.lang.reflect包中的以下几个类: Constructor:表示类中的构造方法 Field:表示类中的属性 Method:表示类中的方法 ...
- Codeforces 118 D. Caesar's Legions (dp)
题目链接:http://codeforces.com/contest/118/problem/D 有n个步兵和m个骑兵要排成一排,其中连续的步兵不能超过k1个,连续的骑兵不能超过k2个. dp[i][ ...
- commondline 之三 执行jar文件
java [-options] -jar jarfile [args...] 点击查看获取可执行jar文件方法
- 获取某几个分类下的前N条数据 mssql语句
方案1: (SELECT top 10 * FROM 表 where type=3 ) UNION ALL (SELECT top 10 * FROM 表 where type=4 ) ...
- Binding的Source从何而来?
I. Binding to Object 1. Binding data using ObjectDataProvider AC:Let’s say there is a CLR based data ...
- Innodb的事务与日志 & JTA事务
InnoDB引擎的行锁是通过加在什么上完成(或称实现)的?为什么是这样子的 通过 行多版本控制 MyISAM Innodb 事物支持 : 不支持 ...
- 关于C#中文本模板(.tt)的简单应用
这两天做项目突遇 .tt文件,之前没有接触过,so查询学习做笔记,帮助记忆和后来者. 在项目添加中点击选择文本模板 下面贴出代码,做了简单的注释 <#@ template debug=" ...
- Function.caller
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/caller 非标准 ...
- vc6.0 通过ADO(udl)连接sql 2008
转载声明:本文转自http://blog.sina.com.cn/s/blog_7328b9dd0100pkbw.html茗之的博客 首先声明:本文是针对vc与sql菜鸟的,高人请让路. 本文讲解 ...