The number of divisors(约数) about Humble Numbers

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1623    Accepted Submission(s): 789

Problem Description
A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers.

Now given a humble number, please write a program to calculate the number of divisors about this humble number.For examle, 4 is a humble,and it have 3 divisors(1,2,4);12 have 6 divisors.

Input
The input consists of multiple test cases. Each test case consists of one humble number n,and n is in the range of 64-bits signed integer. Input is terminated by a value of zero for n.
Output
For each test case, output its divisor number, one line per case.
Sample Input
4 12 0
Sample Output
3 6
Author
lcy
Source
“2006校园文化活动月”之“校庆杯”大学生程序设计竞赛暨杭州电子科技大学第四届大学生程序设计竞赛
Recommend
LL
很简单的题目。。
只要求得有多少个2,3,5,7
然后结果就是  (p2-1)*(p3-1)*(p5-1)*(p7-1)
#include<stdio.h>
int main()
{long long n;int p2,p3,p5,p7;while(scanf("%I64d",&n),n){p2=p3=p5=p7=0;while(n%2==0){n/=2;p2++;}    while(n%3==0){n/=3;p3++;}    while(n%5==0){n/=5;p5++;}    while(n%7==0){n/=7;p7++;}    printf("%d\n",(p2+1)*(p3+1)*(p5+1)*(p7+1));}    return 0;
}    

HDU 1492 The number of divisors(约数) about Humble Numbers(数论,简单约数)相关推荐

  1. HDU 1492 The number of divisors(约数) about Humble Numbers

    The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...

  2. 杭电1492 The number of divisors(约数) about Humble Numbers

    The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Lim ...

  3. HDUOJ---The number of divisors(约数) about Humble Numbers

    The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Lim ...

  4. HDU1492 The number of divisors(约数) about Humble Numbers【约数】

    The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Lim ...

  5. HDU 3826 Squarefree number:题目解答源码

    2019独角兽企业重金招聘Python工程师标准>>> HDU 3826 Squarefree number:题目解答源码 In mathematics,a squarefree n ...

  6. 第F题 真约束之和(通解)古希腊数学家毕达哥拉斯在自然数研究中发现,220的所有真约数(即不是自身的约数)之和为:  1+2+4+5+10+11+20+22+44+55+110=284

    古希腊数学家毕达哥拉斯在自然数研究中发现,220的所有真约数(即不是自身的约数)之和为: 1+2+4+5+10+11+20+22+44+55+110=284. 而284的所有真约数为1.2.4.71. ...

  7. 真约数求法 c语言,怎样求真约数

    匿名用户 1级 2018-11-14 回答 约数 定义 如果一个整数能被另一个整数整除,那么第二个整数就是第一个整数的约数.约数是有限的,一般用最大公约数. (在自然数的范围内) 6的约数有:1.2. ...

  8. 约数的一些定理——数论

    算术基本定理:   又称为正整数的唯一分解定理,即:每个大于1的自然数,要么本身就是质数,要么可以写为2个或以上的质数的积,而且这些质因子按大小排列之后,写法仅有一种方式.   公式:A=(p1^k1 ...

  9. 【HDU】1005 Number Sequence (有点可爱)

    http://acm.hdu.edu.cn/showproblem.php?pid=1005 A number sequence is defined as follows: f(1) = 1, f( ...

最新文章

  1. 解决【Bootstrap‘s JavaScript requires jQuery】的问题
  2. ES5原生api(2)
  3. linux 文件重命名_Linux编程 5 (目录重命名与移动 删除,目录创建删除,查看file)...
  4. 大学计算机学生成绩综合管理系统,大学综合测评成绩管理系统的研究 计算机专业毕业论文.doc...
  5. 吴恩达深度学习 —— 作业2
  6. java manager 模式_java设计模式之装饰器模式(Decorator)
  7. vivado 下载bit报错End of startup status:LOW
  8. 【虹科车用总线技术】PCAN-USB使用手册
  9. 计算机的源端口号是你根据,网络协议的判定是根据源端口还是目的端口?
  10. 数据增强_炼丹笔记三:数据增强
  11. 在java中调用mockjs生成模拟数据
  12. adams打不开提示msc license_adams安装后打不开
  13. matlab portcons,马科维茨投资组合理论(均方模型)学习笔记——基于Matlab(二)...
  14. 解决Hadoop Browse Directory Couldn‘t upload the file 错误.无法上传文件
  15. 什么是1u服务器;服务器中的u是什么意思
  16. PyPI--python软件仓储库
  17. 4点策略教你如何做好社群营销
  18. 总有一款适合你的协同设计工具
  19. 8大底层逻辑,提升思维能力
  20. 期中计算机网络答案,计算机网络基础自考试题「附答案」

热门文章

  1. ant的if-else
  2. 南邮攻防训练平台逆向maze
  3. cookie和session原理
  4. 【转】Create Hello-JNI with Android Studio
  5. linux 进程间通信之pipe
  6. 矩阵快速幂 学习笔记
  7. 做靠谱的程序员--《程序员修炼之道》读书报告
  8. Spring学习(八)AOP详解
  9. C# does not contain a constructor that takes no parameter
  10. 计算程序执行时间的函数