前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >HDUOJ---The number of divisors(约数) about Humble Numbers

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

作者头像
Gxjun
发布2018-03-21 12:03:11
6220
发布2018-03-21 12:03:11
举报
文章被收录于专栏:mlml

The number of divisors(约数) about Humble Numbers

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

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

http://acm.hdu.edu.cn/showproblem.php?pid=1492

Recommend

LL

分解质因数

代码语言:javascript
复制
 1 //http://acm.hdu.edu.cn/showproblem.php?pid=1492
 2 #include<iostream>
 3 #include<cstdio>
 4 using namespace std;
 5 int main()
 6 {
 7     _int64 i,n,c1,c2,c3,c4;
 8     
 9     while(scanf("%I64d",&n),n)
10     { 
11         for(c1=1,i=n;i%2==0&&i!=0;i/=2) 
12                    c1++;
13         for(c2=1,i=n;i%3==0&&i!=0;i/=3)
14                     c2++;
15         for(c3=1,i=n;i%5==0&&i!=0;i/=5) 
16                     c3++;
17          for(c4=1,i=n;i%7==0&&i!=0;i/=7) 
18                     c4++;
19         printf("%I64d\n",c1*c2*c3*c4);
20     }
21 return 0;
22 }
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2013-08-07 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • The number of divisors(约数) about Humble Numbers
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档