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.

InputThe 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. 
OutputFor each test case, output its divisor number, one line per case. 
Sample Input

4
12
0

Sample Output

3
6

题意:给出一个丑数n,这个数必定可以分解成多个2、3、5、7的形式

求:n的因子数

思路:唯一分解定理求因子个数,唯一不同的是唯一分解定理需要记录每个质数的指数,而该题则已经确定是2、3、5、7了,所以只要对这四个数进行计算指数再相互之间+1相乘即可

 #include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
typedef long long ll; //ll n;
//
//ll prime()
//{
// ll ans=0;
// for(ll i=1;i<=n;i++)
// {
// if(n%i==0)
// ans++;
// }
// return ans;
//} int mark[];
int main()
{
ll n;
while(~scanf("%lld",&n)&&n)
{
// printf("%lld\n",prime());
memset(mark,,sizeof(mark));//每个数字的指数
while(n&&n%==)
{
mark[]++;
n=n/;
// cout<<n<<endl;
}
// cout<<"***"<<mark[0]<<endl;
while(n&&n%==)
{
mark[]++;
n=n/;
}
while(n&&n%==)
{
mark[]++;
n=n/;
}
while(n&&n%==)
{
mark[]++;
n=n/;
}
cout<<(+mark[])*(+mark[])*(+mark[])*(+mark[])<<endl;
}
return ;
}

HDU-1492-The number of divisors(约数) about Humble Numbers -求因子总数+唯一分解定理的变形的更多相关文章

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

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

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

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

  3. 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 L ...

  5. 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 ...

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

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

  7. hdu 1492(约数的个数)

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

  8. HDU - 1711 A - Number Sequence(kmp

    HDU - 1711 A - Number Sequence   Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1 ...

  9. HDU 1452 Happy 2004(唯一分解定理)

    题目链接:传送门 题意: 求2004^x的全部约数的和. 分析: 由唯一分解定理可知 x=p1^a1*p2^a2*...*pn^an 那么其约数和 sum = (p1^0+p1^1^-+p1^a1)* ...

随机推荐

  1. 用Cygwin实现在window环境下使用Linux命令-nohup 来后台运行程序

    1.安装Cygwin 下载 cygdrive-选择64或32位   http://www.cygwin.com/ 注:可以百度搜索安装步骤 2.配置它的环境变量 添加到path路径中 3.cmd  执 ...

  2. SpringMVC 拦截器原理

    前言 SpringMVC 拦截器也是Aop(面向切面)思想构建,但不是 Spring Aop 动态代理实现的, 主要采用责任链和适配器的设计模式来实现,直接嵌入到 SpringMVC 入口代码里面. ...

  3. Java高新技术第三篇:注解的使用

    我们知道注解是在JDK1.5引入的,可能有的人没有用过注解,所以感觉注解这个东西没有什么用,但是深入了解注解,对以后学习框架有所帮助的,后面提到的JavaWeb的框架中很多都是基于注解的技术, 其实注 ...

  4. bzoj1045题解

    [解题思路] (数据范围劝退?正确范围应该是n≤1000000) 设xi表示第i个小朋友给第i+1个小朋友的糖果数(特殊的,xn表示第n个小朋友给第1个小朋友的糖果数),Â表示平均糖果数,有如下方程组 ...

  5. Delphi如何实现无边框窗体的移动

    在控件的MouseDown事件中加入if (ssleft in Shift) then begin ReleaseCapture; Perform(WM_syscommand, $F012, 0);e ...

  6. NX二次开发-UFUN拉伸函数UF_MODL_create_extruded

    NX9+VS2012 //NX二次开发中常用拉伸函数为UF_MODL_create_extruded2,但是此函数不能拉伸片体, //想要拉伸片体用函数UF_MODL_create_extruded. ...

  7. idea 社区版+spring boot+ssm+swagger创建rest api

    新手上路,出了好多错,记录一下 1.创建数据库:springBootSsmTest 2.打开IDEA创建 Spring boot项目:File——New——Project——Spring Assist ...

  8. LaTeX+TexStudio安装与使用

    (很多杂志期刊接受LaTeX电子版时会提供自己的模板,只要使用他们的模板即可完美地展现在对应的刊物中) 0x00. 优点 丰富易用的数学公式和特殊符号: 容易生成图表编号.引用.交叉引用.目录: 可以 ...

  9. solr +zookeeper+Jetty 集群搭建

    solr版本:4.10.4 这里使用solr自带的jetty内置服务器 zk集群的 安装参照上篇文章: 在节点1example下上启动solr服务: java -DzkHost=192.168.0.1 ...

  10. spark集群进入 bin 下面目录./spark-shell 出现Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

    spark集群启动的时候可以正常,进入 ./spark-shell 就会出现如下错误 配置文件:spark-env.sh export JAVA_HOME=/usr/java/jdk1.7.0_51e ...