HDU-1492-The number of divisors(约数) about 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 -求因子总数+唯一分解定理的变形的更多相关文章
- HDUOJ---The number of divisors(约数) about Humble Numbers
The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Lim ...
- The number of divisors(约数) about Humble Numbers[HDU1492]
The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Lim ...
- The number of divisors(约数) about Humble Numbers
The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Lim ...
- HDU1492/The number of divisors(约数) about Humble Numbers
题目连接 The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory L ...
- 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 ...
- hdu-1492 The number of divisors(约数) about Humble Numbers---因子数公式
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1492 题目大意: 给出一个数,因子只有2 3 5 7,求这个数的因子个数 解题思路: 直接求出指数即 ...
- hdu 1492(约数的个数)
The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Lim ...
- 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 ...
- HDU 1452 Happy 2004(唯一分解定理)
题目链接:传送门 题意: 求2004^x的全部约数的和. 分析: 由唯一分解定理可知 x=p1^a1*p2^a2*...*pn^an 那么其约数和 sum = (p1^0+p1^1^-+p1^a1)* ...
随机推荐
- <el-table>序号逐次增加,翻页时继续累加,解决翻页时从编号1开始的情况
注释: scope.$index 当前序号 cuePage 表示当前页码 pageSize 表示每页显示的条数
- 泛型(Generic)类的使用原因和使用方式
我们每个苹果都套个盒子,给每本书都套个盒子,但是苹果盒子和书盒子是不同的, 这样下去如果有更多的东西需要套盒子,1000种产品有1000种相应的盒子,造成类型极度膨胀非常难以维护. class Pro ...
- js实现canvas保存图片为png格式并下载到本地
canvas 保存图片 下载到本地 function base64Img2Blob(code){ var parts = code.split(';base64,'); var contentType ...
- 使用Sonatype Nexus搭建Maven私服后,如何添加第三方JAR包
使用Sonatype Nexus搭建Maven私服后如何添加第三方JAR包 步骤如下 1.打开nexus地址,进行登录 2.登录Nexus后,点击右侧的“Repositories”,显示当前Nexus ...
- Delphi GDI(一)
Delphi 7下IGDIPlus库的使用 IGDI+是一个免费开源封装微软GDI+功能的Delphi库,该库使得可以用Delphi语言代码快速简短的实现复杂GDI+应用程序. 官方网站:http:/ ...
- 在Panel上绘图的实现
近期制作了FDS的一个建模工具,由于知识有限,做出的效果是2D的.昨天上课的时候看老师画一个长方体,突然想到,为什么不给普通的2D图形加画上几条直线,就能实现2D图形的3D视觉效果呢?于是回来马上做了 ...
- 使用GDI+绘制的360风格按钮控件
将下面的代码拷贝到一个单元中,创建一个包,加入这个单元后安装.使用的时候设置好背景颜色,边框颜色,图标(png格式)相对路径的文件名称.这个控件可以利用PNG图像的颜色透明特性,背景色默认透明度为50 ...
- NX二次开发-获取坐标系信息UF_CSYS_ask_csys_info
NX9+VS2012 #include <uf.h> #include <uf_csys.h> UF_initialize(); //获取WCS标识 tag_t WcsId = ...
- NX二次开发-如何在类外面定义一个结构体
#include <uf.h> #include <uf_obj.h> #include <uf_part.h> using namespace NXOpen; u ...
- 如何理解Vue的render函数
第一个参数(必须) - {String | Object | Function} <!DOCTYPE html> <html lang="en"> < ...