HDOJ 题目2601 An easy problem(数学 水题)
来源:互联网 发布:淘宝的棉料衣服起球 编辑:程序博客网 时间:2024/06/06 09:29
An easy problem
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6196 Accepted Submission(s): 1490
Problem Description
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 ?
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 ?
Input
The first line contain a T(T <= 2000) . followed by T lines ,each line contain an integer N (0<=N <= 1010).
Output
For each case, output the number of ways in one line.
Sample Input
213
Sample Output
01
Author
Teddy
思路:因式分解n=i*j+i+j,即(n+1)=(i+1)(j+1);
ac代码
#include<stdio.h>#include<math.h>int main(){int i,j,n,t;scanf("%d",&t);while(t--){__int64 n,nc;int c=0,i;scanf("%I64d",&n);n++;nc=sqrt(n);for(i=2;i<=nc;i++){if(n%i==0)c++;}printf("%d\n",c);}}
0 0
- HDOJ 题目2601 An easy problem(数学 水题)
- hdoj 2601 An easy problem (数学)
- hdoj 2601 An easy problem(数学)
- HDOJ 题目2132 An easy problem(水题,易错)
- HDU 2601 An easy problem (数学)
- 数学 hdu 2601 (An easy problem)
- hdoj 2601 An easy problem
- HDOJ-【2601 An easy problem】
- hdoj An easy problem
- hdoj 2601 An easy problem 【技巧(转换思维)】
- HDU 2601:An easy problem【数学】
- HDU 2601 An easy problem(数学转换)
- HDU 2601:An easy problem【数学】
- hdu2601 An easy problem(数学)
- An easy problem hdoj 2055
- HDOJ 2055 An easy problem
- HDOJ 2055 An easy problem
- HDOJ 2055 An easy problem
- cocos2dx 3.0 快捷创建工程方法
- poj1141 Brackets Sequence
- 数据结构--数组和广义表--数组的顺序存储表示和实现
- oracle 口令失效问题处理
- 快速排序
- HDOJ 题目2601 An easy problem(数学 水题)
- http version scan
- Nginx配置https服务器
- Chapter 1 Securing Your Server and Network(7):禁用SQL Server Browse
- android解决gridview只显示一半
- Hadoop 文件命令
- 简单实用的打印函数执行日志的代码WriteLog函数
- php操作mysql的基本函数
- Java类库(章节摘要)