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. javascript 跨域问题 jsonp

    转载:http://www.cnblogs.com/choon/p/5393682.html demo 用动态创建<script></script>节点的方式实现了跨域HTTP ...

  2. 小程序学习三 一切的开始app() 小程序的注册

    现在打开 app.js //app.js App({ onLaunch(options) { //小程序初始化 // console.log("小程序初始化", options) ...

  3. 区别 |DCL |DDL |DML |DQL

    DCL(Data Control Language)数据控制语言: 用来设置或更改数据库用户或角色权限的语句,包括(grant,deny,revoke等)语句.这个比较少用到. 对于大多数人,在公司一 ...

  4. NX二次开发-UFUN更改图纸页比例UF_DRAW_set_drawing_info

    #include <uf.h> #include <uf_draw.h> #include <uf_part.h> UF_initialize(); //获得当前图 ...

  5. NX二次开发-UFUN编辑图层类别名字UF_LAYER_edit_category_name

    NX11+VS2013 #include <uf.h> #include <uf_layer.h> UF_initialize(); //创建图层类别 UF_LAYER_cat ...

  6. NX二次开发-UFUN将目录与文件名组合在一起uc4575

    NX11+VS2013 #include <uf.h> #include <uf_ui.h> #include <uf_cfi.h> UF_initialize() ...

  7. GTK+/GNOME编程(一)

    1.开发环境:安装GTK+/GNOME库 #apt-get install gtk+-3.0                   (安装GTK+库文件) #apt-get install gnome- ...

  8. 2、http请求与http响应

    我们在接口测试过程中,可能会用http协议,webservice协议,当然用的较多的还是http协议,webservice协议在此不做过多介绍,我们先了解一下http协议,然后重点介绍http请求与响 ...

  9. union, enum, and struct, 以及结构填充和位字段实现。

    Table 4-9 Compiler storage of data objects by byte alignment Type Bytes Alignment char, bool, _Bool ...

  10. 史上最全Html和CSS布局技巧

      单列布局水平居中 水平居中的页面布局中最为常见的一种布局形式,多出现于标题,以及内容区域的组织形式,下面介绍四种实现水平居中的方法(注:下面各个实例中实现的是child元素的对齐操作,child元 ...