题目连接


The number of divisors(约数) about Humble Numbers

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 3416 Accepted Submission(s): 1676

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校园文化活动月”之“校庆杯”大学生程序设计竞赛暨杭州电子科技大学第四届大学生程序设计竞赛

/*
求一个数的约数:x=p1^x1 * p2^x2 * p3^x3.....
p1\p2\p3分别为素数,那么x的约数的个数就是ans=(x1+1)*(x2+1)*(x2+1)....
*/
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long LL;
using namespace std;
int a[6]={2,3,5,7};
int main ()
{
LL n;
while(scanf("%lld",&n),n)
{
LL ans=1;
int i=0;
int t=0;
while(n)
{
if(n%a[i]==0)
{
t++;
n/=a[i];
}
else
{
ans*=(t+1);
t=0;
i++;
if(n==1)
break;
} }
printf("%lld\n",ans);
}
return 0;
}

HDU1492/The number of divisors(约数) about Humble Numbers的更多相关文章

  1. The number of divisors(约数) about Humble Numbers[HDU1492]

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

  2. 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. HDU - The number of divisors(约数) about Humble Numbers

    Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence ...

  5. HDU-1492-The number of divisors(约数) about Humble Numbers -求因子总数+唯一分解定理的变形

    A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, ...

  6. hdu-1492 The number of divisors(约数) about Humble Numbers---因子数公式

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1492 题目大意: 给出一个数,因子只有2 3 5 7,求这个数的因子个数 解题思路: 直接求出指数即 ...

  7. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  8. A - Humble Numbers

    Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Pract ...

  9. Humble Numbers

    Humble Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9988 Accepted: 4665 Descri ...

随机推荐

  1. 如何安全退出已调用多个Activity的Application?

    如何退出Activity?如何安全退出已调用多个Activity的Application? 退出Activity直接调用finish()方法  //用户点击back键就是退出一个Activity 退出 ...

  2. JSP中的EL语言

    1,EL(Expression Language)是从JavaScript得到启发的一种表达式语言, 2,EL表达式包含文字,操作符,变量,函数调用: 3,EL 存取变量的语法格式:${ userna ...

  3. Python 文本处理的应用

    最近根据公司运营部需求要对mongo数据库中的相关信息进行统计,本人一般喜欢将数据库服务器中相关的数据导出来(PS:其一由于Mongo为Nosql,在涉及关联表时不好处理,其二是因为虽然为测试环境,但 ...

  4. 怎样正确设置remote_addr和x_forwarded_for

    怎样正确设置remote_addr和x_forwarded_for 2013-04-20 做网站时经常会用到remote_addr和x_forwarded_for这两个头信息来获取客户端的IP,然而当 ...

  5. ubuntn安装五笔输入法

    1.首先要把原来的 ibus 卸载掉 sudo apt-get remove ibus 2.添加源 sudo add-apt-repository ppa:fcitx-t(www.111cn.net) ...

  6. 基于Flash ActionScript 实现RTMP发布与播放媒本流

    1  为什么要采用Flash ActionScript实现RTMP协议发布或播放媒体流,播放媒体流,协议可控,比如对流媒体数加密,混音等. 2 核心思路使用Flash Socket建立TCP二进制传输 ...

  7. LibRTMP优化之调整输出块大小

    1. 为什么要调整输出块大小 首先在RTMP_Connect0函数中LibRTMP是关闭了Nagle算法这个TCP选项的,为了实时性这样做是好的,但是要注意到LibRTMP的结构体RTMP的成员是有m ...

  8. 初试LIBSVM

    在做Kinect手势识别项目的时候用到了SVM这个东西.原理上不甚了解,但是用起来感觉还是很神奇的. 度娘百科:支持向量机SVM(Support Vector Machine)作为一种可训练的机器学习 ...

  9. Chapter 2 Open Book——16

    By Friday I was perfectly comfortable entering my Biology class, nolonger worried that Edward would ...

  10. java代码中 路径符号的写法

    String path="D:\\新建文件夹\\2.png"; File file=new File(path); System.out.println(file.exists() ...