A problem is easy

时间限制:1000 ms  |  内存限制:65535 KB
难度:3
 
描述
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
#include <iostream>
#include <vector>
#include <cmath>
using namespace std; int main(){
int T;
cin >> T;
for(int icase = ; icase < T; icase ++){
int n;
cin >> n;
n++;
int res = ;
for(int i = ; i <= (int)sqrt(n); ++ i){
if(n%i == ) res ++ ;
}
cout<< res<<endl;
}
}

最新文章

  1. jquery bootgrid 一个很好的 数据控件,可用于任何语言
  2. Redis集群功能概述
  3. jquery easyUI 日期格式化,DateBox只显示年
  4. delphi参数传递
  5. VirtualBox的usb支持
  6. thinkphp 总结 转
  7. Python学习笔记3-文件的简单操作
  8. java笔记之数据类型
  9. jQuery 自学笔记—5 遍历
  10. curl -windows下接口通讯
  11. 织梦dedecms如何去除版权中的Power by DedeCms
  12. 用Arduino制作一个二维码显示器
  13. Android智能指针SP WP使用方法介绍
  14. svn Advanced
  15. C#轻量级日志监控器EasyLogMonitor
  16. BugPhobia开发篇章:Beta阶段第V次Scrum Meeting
  17. Android带进度条的文件上传,使用AsyncTask异步任务
  18. BZOJ5091: [Lydsy1711月赛]摘苹果【期望DP】
  19. QuantStart量化交易文集
  20. Java集合—Queue(转载)

热门文章

  1. highcharts的简单使用
  2. ActiveMQ的几种集群配置
  3. Delphi 的知识体系
  4. 几年前做家教写的C教程(之三专讲了递归和斐波那契)
  5. ytu 1064: 输入三个字符串,按由小到大的顺序输出(水题,字符串处理)
  6. thinkphp 两表、三表联合查询
  7. Codeforces Round #143 (Div. 2) E. Cactus 无向图缩环+LCA
  8. Silverlight中的TabControl如何绑定数据?重写tabcontrol和tabItem 解决绑定友好问题。可以绑定对象集合
  9. LayoutInflater(四)
  10. Servlet请求头response应用简单案例