题目连接


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. hdu_3341_Lost's revenge(AC自动机+状态hashDP)

    题目链接:hdu_3341_Lost's revenge 题意: 有n个模式串,一个标准串,现在让标准串重组,使得包含最多的模式串,可重叠,问重组后最多包含多少模式串 题解: 显然是AC自动机上的状态 ...

  2. kettle在linux启动spoon.sh报错

    org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]     at org.eclipse.swt.SWT.error ...

  3. 第三次冲刺spring会议(第五次会议)

    [例会时间]2014/5/24 21:15 [例会地点]9#446 [例会形式]轮流发言 [例会主持]马翔 [例会记录]兰梦 小组成员:兰梦 ,马翔,李金吉,赵天,胡佳奇

  4. NOIP2005-普及组复赛-第二题-校门外的树

    题目描述 Description 某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米.我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置:数轴上的每个整数点,即0 ...

  5. MVC DisplayTemplates and EdiotrTemplates.

    我们在mvc项目里经常要对枚举,日期,副文本输入,我们可以用笨拙的方法去view页面里绑定呈现的html内容,而且这种办法不能重用,也就是在不同的view里还是需要做相同的事情,给个日期空间选择例子吧 ...

  6. 转 精选37条强大的常用linux shell命令组合

    1 删除0字节文件 find . -type f -size 0 -exec rm -rf {} \; find . type f -size 0 -delete 2 查看进程,按内存从大到小排列 p ...

  7. sql语句--查询语句(MySQL)

    1.截取字符串 left(str, length),right(str, length),substring(str, pos, length) 原文:http://www.jb51.net/arti ...

  8. selenium 百度登陆

    using System;using OpenQA.Selenium;using OpenQA.Selenium.Firefox;//引用命名空间using System.IO; using Syst ...

  9. hdu_4824_Disk Schedule(dp)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4824 题意:中文,不解释 题解:双调欧几里德旅行商问题,具体可看dp双调欧几里德旅行商,这里注意的是起 ...

  10. beego: 获取request参数

    beego提供了一套web开发的框架.但我们在开发过程中遇到了一些问题,现汇总如下. 测试1:测试只有keys数组的情况 func (this *TestController) Index() { k ...