数学--数论-- HDU 2601 An easy problem(约束和)
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 ?
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
2
1
3
Sample Output
0
1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;int main(){int t;long long n,i,j,ans;scanf ("%d",&t);while (t--){ans=0;scanf ("%lld",&n);n++;for (i=2;i*i<=n;i++){if (n%i==0)ans++;}printf ("%lld\n",ans);}return 0;
}
数学--数论-- HDU 2601 An easy problem(约束和)相关推荐
- 数学--数论--HDU - 6395 Let us define a sequence as below 分段矩阵快速幂
Your job is simple, for each task, you should output Fn module 109+7. Input The first line has only ...
- 数学--数论--HDU 12151七夕节 Plus (因子和线性筛)
Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!" ...
- 数学--数论--HDU - 6322 打表找规律
In number theory, Euler's totient function φ(n) counts the positive integers up to a given integer n ...
- 数学--数论--HDU 4675 GCD of Sequence(莫比乌斯反演+卢卡斯定理求组合数+乘法逆元+快速幂取模)
先放知识点: 莫比乌斯反演 卢卡斯定理求组合数 乘法逆元 快速幂取模 GCD of Sequence Alice is playing a game with Bob. Alice shows N i ...
- 数学--数论--HDU 2674 沙雕题
WhereIsHeroFrom: Zty, what are you doing ? Zty: I want to calculate N!.. WhereIsHeroFrom: So easy! H ...
- 数学--数论--HDU 2582 F(N) 暴力打表找规律
This time I need you to calculate the f(n) . (3<=n<=1000000) f(n)= Gcd(3)+Gcd(4)+-+Gcd(i)+-+Gc ...
- 数学--数论--HDU 12151七夕节
七夕节 Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!&q ...
- HDOJ(HDU) 2123 An easy problem(简单题...)
Problem Description In this problem you need to make a multiply table of N * N ,just like the sample ...
- HDU 2055 An easy problem
继续水水 #include <stdio.h> int main ( ) {int n;scanf ( "%d" , &n );while ( n-- ){in ...
最新文章
- 写一个ArrayList类的动态代理类
- BZOJ4197 [Noi2015]寿司晚宴 【状压dp】
- CollaDec 之前的三个SharePoint工具开源发布
- 初识HTML5(一)
- C语言基础教程之常量
- 网络虚拟化基础协议之Geneve
- 找回计算机管理账户,怎样找回原来的电脑用户账号?
- Mac屏幕常亮时间控制:Theine
- PDF怎么翻译成中文?这些方法值得收藏
- 字符串函数和数据类型转换函数
- vue 富文本编辑器 —— wangEditor
- 全国2016年实施不动产登记 潘石屹预言房价下跌
- 序列标注 | (4) Hierarchically-Refined Label Attention Network for Sequence Labeling
- 面试官问“为什么应聘这个岗位”,应该如何回答?
- 大数据即席查询工具——秒级响应
- 谈谈Http长连接和Keep-Alive以及Tcp的Keepalive
- 作为开发用的GUI音频处理软件推荐--wavosaur
- /LGC图形渲染/Graphics 文化系列 -- Loren Carpenter与分形山脉
- PHP初级【10天小积累-第二天】
- 通过mbrfix了解硬盘
热门文章
- Android 百度地图之全局搜索周边搜索全国搜索城市路线规划(升级版附源码)
- 调用python接口并画图_【PySpark源码解析】教你用Python调用高效Scala接口
- eltree ref什么时候有_DBA:为什么你老写慢SQL
- 想问一下C++里queue要怎么遍历
- 怎么将pdf转换成word
- 【对讲机的那点事】450MHz模拟无线列调的工作原理(连载五)
- 【安全牛学习笔记】漏洞扫描
- 美国和中国将成数据中心建设首选之地
- 关于might_sleep的一点说明---CONFIG_DEBUG_ATOMIC_SLEEP【转】
- web.xml配置(转)