nyoj 216-A problem is easy ((i + 1) * (j + 1) = N + 1)
216-A problem is easy
内存限制:64MB
时间限制:1000ms
特判: No
通过数:13
提交数:60
难度:3
题目描述:

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)的更多相关文章
- 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 ...
- A problem is easy
描述When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’ ...
- nyoj A+B Problem IV
A+B Problem IV 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 acmj最近发现在使用计算器计算高精度的大数加法时很不方便,于是他想着能不能写个程序把这 ...
- NYOJ 219 An problem about date
An problem about date 时间限制:2000 ms | 内存限制:65535 KB 难度:2 描述 acm的iphxer经常忘记某天是星期几,但是他记那天的具体日期,他希望你 ...
- nyoj 803-A/B Problem
803-A/B Problem 内存限制:64MB 时间限制:1000ms 特判: No 通过数:2 提交数:4 难度:3 题目描述: 做了A+B Problem,A/B Problem不是什么问题了 ...
- nyoj 844-A+B Problem(V) (string[::-1] 字符串反转)
844-A+B Problem(V) 内存限制:64MB 时间限制:1000ms 特判: No 通过数:14 提交数:17 难度:1 题目描述: 做了A+B Problem之后,Yougth感觉太简单 ...
- nyoj 513-A+B Problem IV (java BigDecimal, stripTrailingZeros, toPlainString)
513-A+B Problem IV 内存限制:64MB 时间限制:1000ms 特判: No 通过数:1 提交数:2 难度:3 题目描述: acmj最近发现在使用计算器计算高精度的大数加法时很不方便 ...
- nyoj 477-A+B Problem III (fabs() <= 0.00001)
477-A+B Problem III 内存限制:64MB 时间限制:1000ms 特判: No 通过数:18 提交数:34 难度:1 题目描述: 求A+B是否与C相等. 输入描述: T组测试数据. ...
随机推荐
- 关于用gulp合并压缩seaJs模块
现在很多人都在用seaJs来开发项目,seaJs上手容易,操作简单.但在后期做合并压缩的时候却中了个巨大无比的坑,但坑也总得有人来填.于是花了将近一个星期的时间来填了这坑,现将填坑的一些心得与大家分享 ...
- Oier们的幸运数字
题目描述 JerryC对数字痴迷到了一种非正常的境界.每天JerryC都有喜欢的一些数字.第 iii 天JerryC就喜欢Ai−BiA_i-B_iAi−Bi中的数字.但是他觉得这样并不是很有趣,于 ...
- [Luogu3065][USACO12DEC]第一!First!
题目描述 Bessie has been playing with strings again. She found that by changing the order of the alphabe ...
- ggstatsplot绘图|统计+可视化,学术科研神器
本文首发于“生信补给站”公众号,https://mp.weixin.qq.com/s/zdSit97SOEpbnR18ARzixw 更多关于R语言,ggplot2绘图,生信分析的内容,敬请关注小号. ...
- Spring Cloud Alibaba(三)Sentinel之熔断降级
本项目演示如何使用 Sentinel 完成 Spring Cloud 应用的熔断降级调用. Sentinel 是阿里巴巴开源的分布式系统的流量防卫组件,Sentinel 把流量作为切入点,从流量控制, ...
- Java 获取前一天的24小时
//获取凌晨时间 public static Date getTodayStartTime(){ Calendar todayEnd = Calendar.getInstance(); todayEn ...
- ORACLE定时备份方案
ORACLE定时备份方案 采用ORACLE的EXP工具,实现ORACLE的备份:采用LINUX的服务crond实现定时功能. 1 编辑SH,实现备份功能 #vi oracle_backup.sh,输入 ...
- Mysql数据库(九)备份与恢复
一.数据备份 1.使用mysqldmp命令备份 (1)备份一个数据库 mysqldump -u root -p dbname table1 table2 ... > D:\BackName.sq ...
- Xbim.GLTF源码解析(二):IFC和GLTF的对应关系
原创作者:flowell,转载请标明出处:https://www.cnblogs.com/flowell/p/10839179.html IFC IFC是建筑信息模型(BIM)数据开放的国际标准,在建 ...
- SpringCloud之Feign和Ribbon的选择(五)
Ribbon Ribbon 是一个基于 HTTP 和 TCP 客户端的负载均衡器它可以在客户端配置 ribbonServerList(服务端列表),然后轮询请求以实现均衡负载它在联合 Eureka 使 ...