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. Jenkins 搭建 .NET FrameWork 持续集成环境

    本文不赘述如何安装 Jenkins,如有需要请看之前文章,这里我们主要搭建 .Net 环境.本文是在 Windows 环境下安装的 Jenkins 进行操作     一.安装所需环境     这里我们 ...

  2. Java 导出excel进行换行

    在导出excel 的时候,如果原始文字中含有 \n 字符,生成的excel中 会生成 _0040_ 字样的乱码, 如果把 \n 替换为<br/>,excel不会识别成换行符 excel 认 ...

  3. thinkphp 标签库驱动

    任何一个模板引擎的功能都不可能是为你量身定制的,具有一个良好的可扩展机制也是模板引擎的另外一个考量,Smarty采用的是插件方法来实现扩展,Think\Template由于采用了标签库技术,比Smar ...

  4. nutch集成solr和中文分词

    nutch集成solr和中文分词 一.构建nutch环境 1. 设置代理 由于nutch使用ant构建,ant调用ivy,会从maven仓库中下载依赖包,因此若公司需要代理才能上网,需要设置代理,如果 ...

  5. RN相关命令

    添加第三方库 npm install --save xxx react-native link  链接库 react-native react-native -v 查看RN版本 npm info re ...

  6. cv2.imwrite()指定图片存储路径

    cv2.imwrite("./data/photo_{}.jpg".format(i), photo)

  7. Android Telephony分析(五) ---- TelephonyRegistry详解

    本文紧接着上一篇文章<Android Telephony分析(四) —- TelephonyManager详解 >的1.4小节.从TelephonyRegistry的大部分方法中: 可以看 ...

  8. spark-sql createOrReplaceTempView 和createGlobalTempView区别

    在讲解 createOrReplaceTempView 和createGlobalTempView的区别前,先了解下Spark Application 和  Spark Session区别 Spark ...

  9. 学习k8s的经验

    最近在学k8s,总结一下安装k8s的坑. 1.晚上关于k8s的学习资料很多,多不如精,这个博客很好,https://blog.csdn.net/sinat_35930259/article/categ ...

  10. 第一周课堂笔记1th

    1.      计算机基本组成 CPU:中央处理器,人的大脑 内存:临时存储数据       (特点:断电即消失,容量小12G 24G) 硬盘:永久存储数据(特点:断电不消失容量大,500G 1T) ...