216-A problem is easy

内存限制:64MB
时间限制:1000ms
特判: No

通过数:13
提交数:60
难度: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

C/C++  AC:

 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#include <queue>
#include <climits> using namespace std; int main()
{
long long T, a, b;
cin >>T;
while (T --)
{
scanf("%lld", &a);
b = sqrt(a + );
long long cnt = ;
for (int i = ; i <= b; ++ i)
{
if ((a + ) % i == )
++ cnt;
}
printf("%lld\n", cnt);
}
}

nyoj 216-A problem is easy ((i + 1) * (j + 1) = N + 1)的更多相关文章

  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. A problem is easy

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

  4. nyoj A+B Problem IV

    A+B Problem IV 时间限制:1000 ms  |  内存限制:65535 KB 难度:3   描述 acmj最近发现在使用计算器计算高精度的大数加法时很不方便,于是他想着能不能写个程序把这 ...

  5. NYOJ 219 An problem about date

    An problem about date 时间限制:2000 ms  |  内存限制:65535 KB 难度:2   描述 acm的iphxer经常忘记某天是星期几,但是他记那天的具体日期,他希望你 ...

  6. nyoj 803-A/B Problem

    803-A/B Problem 内存限制:64MB 时间限制:1000ms 特判: No 通过数:2 提交数:4 难度:3 题目描述: 做了A+B Problem,A/B Problem不是什么问题了 ...

  7. nyoj 844-A+B Problem(V) (string[::-1] 字符串反转)

    844-A+B Problem(V) 内存限制:64MB 时间限制:1000ms 特判: No 通过数:14 提交数:17 难度:1 题目描述: 做了A+B Problem之后,Yougth感觉太简单 ...

  8. nyoj 513-A+B Problem IV (java BigDecimal, stripTrailingZeros, toPlainString)

    513-A+B Problem IV 内存限制:64MB 时间限制:1000ms 特判: No 通过数:1 提交数:2 难度:3 题目描述: acmj最近发现在使用计算器计算高精度的大数加法时很不方便 ...

  9. nyoj 477-A+B Problem III (fabs() <= 0.00001)

    477-A+B Problem III 内存限制:64MB 时间限制:1000ms 特判: No 通过数:18 提交数:34 难度:1 题目描述: 求A+B是否与C相等. 输入描述: T组测试数据. ...

随机推荐

  1. 【Cocos2d-x】学习笔记目录

    从2019年7月开始学习游戏引擎Cocos2dx,版本3.17. 学习笔记尽量以白话的形式表达自己对源码的理解,而不是大篇幅复制粘贴源码. 本人水平有限,欢迎批评指正! Cocos2d-x 学习笔记 ...

  2. caffe中softmax源码阅读

    (1) softmax函数                                      (1) 其中,zj 是softmax层的bottom输入, f(zj)是softmax层的top输 ...

  3. xss姿势利用

    1.定位页面可以出现xss的位置 可能会出现联合点利用 一个页面多个存储位置或者一个页面多个参数联合利用 例如输入xss 查看页面源码页面里有多个xss 或者多个参数显示 可以利用 需要注意的是有的是 ...

  4. shell基本运算符(五)

    shell支持多种运算符,包括:算术运算符.关系运算符.布尔运算符.字符串运算符.文件测试运算符. 注意:条件表达式要放在方括号之间,并且要有空格,eg:[$a==$b] 是错误的,必须写成 [ $a ...

  5. python编程系列---多线程共享全局变量出现了安全问题的解决方法

    多线程共享全局变量出现了安全问题的解决方法 当多线程共享全局变量时,可能出现安全问题,解决机制----互斥锁:即在在一段与全局变量修改相关的代码中,假设一个时间片不足以完成全局变量的修改,就在这段代码 ...

  6. 介绍Webflux

    介绍Webflux 关于WebFlux 我们知道传统的Web框架,比如说:struts2,springmvc等都是基于Servlet API与Servlet容器基础之上运行的,在Servlet3.1之 ...

  7. 搭建ASP.NET Core WebApi项目

    步骤 从“文件”菜单中选择“新建”>“项目” . 选择“ASP.NET Core Web 应用程序”模板,再单击“下一步” . 将项目命名为 NetCoreWebApi,然后单击“创建” . 选 ...

  8. day10作业(函数实现注册''')

    在猜年龄的基础上编写登录.注册方法,并且把猜年龄游戏分函数处理,如 登录函数 注册函数 猜年龄函数 选择奖品函数 '''在猜年龄的基础上编写登录.注册方法,并且把猜年龄游戏分函数处理,如 2. 登录函 ...

  9. 使用webpack命令打包时,报错TypeError: Cannot read property 'presetToOptions' of undefined的解决办法

    我只安装了webpack,没有安装webpack-cli,第一次输入webpack打包时,提示 One CLI for webpack must be installed. These are rec ...

  10. InitializingBean,spring 初始化bean

    springframework的提供接口,InitializingBean接口为bean提供了初始化方法的方式,它只包括afterPropertiesSet方法,凡是继承该接口的类,在初始化bean的 ...