ACM A problem is easy
2024-10-13 12:35:38
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;
}
}
最新文章
- jquery bootgrid 一个很好的 数据控件,可用于任何语言
- Redis集群功能概述
- jquery easyUI 日期格式化,DateBox只显示年
- delphi参数传递
- VirtualBox的usb支持
- thinkphp 总结 转
- Python学习笔记3-文件的简单操作
- java笔记之数据类型
- jQuery 自学笔记—5 遍历
- curl -windows下接口通讯
- 织梦dedecms如何去除版权中的Power by DedeCms
- 用Arduino制作一个二维码显示器
- Android智能指针SP WP使用方法介绍
- svn Advanced
- C#轻量级日志监控器EasyLogMonitor
- BugPhobia开发篇章:Beta阶段第V次Scrum Meeting
- Android带进度条的文件上传,使用AsyncTask异步任务
- BZOJ5091: [Lydsy1711月赛]摘苹果【期望DP】
- QuantStart量化交易文集
- Java集合—Queue(转载)
热门文章
- highcharts的简单使用
- ActiveMQ的几种集群配置
- Delphi 的知识体系
- 几年前做家教写的C教程(之三专讲了递归和斐波那契)
- ytu 1064: 输入三个字符串,按由小到大的顺序输出(水题,字符串处理)
- thinkphp 两表、三表联合查询
- Codeforces Round #143 (Div. 2) E. Cactus 无向图缩环+LCA
- Silverlight中的TabControl如何绑定数据?重写tabcontrol和tabItem 解决绑定友好问题。可以绑定对象集合
- LayoutInflater(四)
- Servlet请求头response应用简单案例