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;
}
}

ACM A problem is easy的更多相关文章

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

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

  2. 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 , ...

  3. A problem is easy

    描述When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’ ...

  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. EasyUi–8.datebox赋值的问题

    这个问题要从EasyUI的datebox组件说起,小菜用这个组件的时候,发现用$("#id").val()这种形式,居然拿不到文本框的值!      经过度娘的帮助,发现可以用$( ...

  2. MVC – 14.ajax异步请求

    14.1.配置文件 14.2.AjaxHelper – 异步链接按钮 14.3.AjaxHelper – 异步表单 AjaxOptions常见属性: 14.4.AjaxOptions对象生成[对应]触 ...

  3. wireshark使用

    http://jingyan.baidu.com/article/7f41ececede744593c095c79.html

  4. MySQL中TIMESTAMPDIFF和TIMESTAMPADD函数的用法

    在MySQL应用时,经常要使用这两个函数TIMESTAMPDIFF和TIMESTAMPADD. 一,TIMESTAMPDIFF 语法: TIMESTAMPDIFF(interval,datetime_ ...

  5. git branch用法总结

    git branch      git branch 不带参数:列出本地已经存在的分支,并且在当前分支的前面加“*”号标记,例如:   #git branch* master   newbranch ...

  6. Centos 上使用Mono+MVC5+WebApi+Sqlite

    鉴于现在网上很多Mono安装Jexus的方法已经过时,你打开百度搜索基本是几个前辈写的文字,很多其实是过去式了.踩的坑多自然使人望而生畏,而方便快捷的方法百度排名却太低,这里就安利下笔者刚成功使用的方 ...

  7. [Tools] Eclipse更改类注释自动生成模板

    [背景] 使用之中发现一些eclipse使用的小技巧,记录下来供以后查阅   由于机器是老婆的,创建新类的时候或者生成注释的时候全都是她的名字,避免弄混,需要设置一下: 设置创建新类时自动生成类或方法 ...

  8. 关于UltraISO打开iso文件后只有部分文件问题

    背景:在安装CentOS 7的时候,用UltraISO打开之后,只有一个EFI文件,刻完U盘,却无法引导. 之前还以为偶没下载全,就又下了一遍,还好偶搞得的NetInstall,要不然就呵呵了. 解决 ...

  9. 常见IE浏览器bug及其修复方案(双外边距、3像素偏移、绝对定位)

    1. 双外边距浮动bug IE6和更低版本中存在双外边距浮动bug,顾名思义,这个Windows bug使任何浮动元素上的外边距加倍 bug重现: <!DOCTYPE html> < ...

  10. struts2框架快速入门小案例

    struts2快速入门: index.jsp------>HelloAction--------->hello.jsp struts2流程 1.导入jar包 struts2的目录结构: a ...