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 ...
随机推荐
- 何时使用hadoop fs、hadoop dfs与hdfs dfs命令
hadoop fs:使用面最广,可以操作任何文件系统. hadoop dfs与hdfs dfs:只能操作HDFS文件系统相关(包括与Local FS间的操作),前者已经Deprecated,一般使用后 ...
- CSS3每日一练之内容处理-嵌套编号
出处:http://www.w3cfuns.com/thread-5592229-1-17.html 1.大标题一 1.子标题 2.子标题 3.子标题2.大标题二 1.子标题 2. ...
- 查询processlist具体信息
SELECT * FROM information_schema.PROCESSLIST WHERE HOST LIKE '%172.16.10.22%' AND COMMAND <> ' ...
- 分享吉林大学机械科学与工程学院,zhao jun 博士的Halcon学习过程及知识分享
分享吉林大学机械科学与工程学院,zhao jun 博士的Halcon学习过程及知识分享 全文转载zhao jun 博士的新浪博客,版权为zhaojun博士所有 原文地址:http://blog.sin ...
- (VC)解决绘图时闪烁问题的一点经验[转]
转自:http://www.cnblogs.com/lidabo/p/3429862.html 清除屏幕闪烁 (转自网上) <一> 由于作图过于复杂和频繁,所以时常出现闪烁的情况,一些防止 ...
- erlang: Programming Rules and Conventions。
http://www.erlang.se/doc/programming_rules.shtml#HDR33 http://www.erlang.org/eeps/eep-0008.html
- 【S16】了解如何把vector和string数据传给旧的API
1.尽量使用vector和string替换数组,但是老的代码还是使用数组.如果老的接口期望是数组,怎么办? 需要把vector和string,暴露出数组接口,也就是第一个元素的地址. 2.考虑方法Do ...
- URL路由规则实例
1.设置支持路由和写路由规则
- Eclipse使用jre的原理与配置
近期要配置Eclipse环境,Mark当中的一些方法. 下载Eclipse SDK之后我们就要关联JRE,由于Eclipse启动须要JRE. Eclipse启动时寻找JRE的顺序: 1.假设eclip ...
- JavaScript实现http地址自动检测并添加URL链接
一.天生我材必有用 给http字符自动添加URL链接是比较常见的一项功能.举两个我最近常用到的自动检测http://地址并添加链接的例子吧,首先是QQ邮箱,在使用QQ邮箱时,如果输入了URL地址(ht ...