The number of divisors(约数) about Humble Numbers

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3337    Accepted Submission(s): 1632

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
 
如果n = p1a1p2a2p3a3...pnan 那么根据乘法原理,约数的个数为 (a1+1)*(a2+1)...(an+1)
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
using namespace std;
typedef long long LL; int main()
{
LL n;
while(scanf("%lld",&n)!=EOF,n)
{
int cnt = ;
int a=,b=,c=,d=;
if(n%==)
{
while(n%==)
{
n/=;
a++;
}
}
if(n%==)
{
while(n%==)
{
n/=;
b++;
}
}
if(n%==)
{
while(n%==)
{
n/=;
c++;
}
}
while(n%==)
{
while(n%==)
{
n/=;
d++;
}
}
printf("%lld\n",(LL)(+a)*(+b)*(+c)*(+d));
}
}

hdu 1492(约数的个数)的更多相关文章

  1. 九度oj 题目1087:约数的个数

    题目链接:http://ac.jobdu.com/problem.php?pid=1087 题目描述: 输入n个整数,依次输出每个数的约数的个数 输入: 输入的第一行为N,即数组的个数(N<=1 ...

  2. 九度OJ 1087 约数的个数

    题目地址:http://ac.jobdu.com/problem.php?pid=1087 题目描述: 输入n个整数,依次输出每个数的约数的个数 输入: 输入的第一行为N,即数组的个数(N<=1 ...

  3. hdu 1028 母函数 一个数有几种相加方式

    ///hdu 1028 母函数 一个数有几种相加方式 #include<stdio.h> #include<string.h> #include<iostream> ...

  4. 问题 D: 约数的个数

    问题 D: 约数的个数 时间限制: 1 Sec  内存限制: 32 MB提交: 272  解决: 90[提交][状态][讨论版][命题人:外部导入] 题目描述 输入n个整数,依次输出每个数的约数的个数 ...

  5. 九度OJ 1087:约数的个数 (数字特性)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:7349 解决:2306 题目描述: 输入n个整数,依次输出每个数的约数的个数 输入: 输入的第一行为N,即数组的个数(N<=1000) ...

  6. 【九度OJ】题目1087:约数的个数 解题报告

    [九度OJ]题目1087:约数的个数 解题报告 标签(空格分隔): 九度OJ 原题地址:http://ac.jobdu.com/problem.php?pid=1087 题目描述: 输入n个整数,依次 ...

  7. HDU 1452 (约数和+乘法逆元)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1452 题目大意:求2004^X所有约数和,结果mod 29. 解题思路: ①整数唯一分解定理: 一个 ...

  8. HDU 1019 (多个数的最小公倍数)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1019 Least Common Multiple Time Limit: 2000/1000 MS (J ...

  9. hdu 1258 从n个数中找和为t的组合 (DFS)

    题意:首先给你一个t,然后是n,后面输入n个数,然后让你求的是n个数中和为t的序列总共有多少种,把他们按从左到右的顺序输出来. Sample Input4 6 4 3 2 2 1 15 3 2 1 1 ...

随机推荐

  1. Flask初学者:Python虚拟环境,Flask安装,helloworld,run方法

    一.Python虚拟环境: 作用:使Python框架的不同版本可以在同一台电脑上运行.如果在电脑上全局(C盘或者其他目录)安装Flask(或其他Python框架),当你使用其他版本的Flask(比如有 ...

  2. Compoer介绍

    Compoer介绍 Composer 是 PHP 的一个依赖管理工具.它允许你申明项目所依赖的代码库,它会在你的项目中为你安装他们. 安装Composer Composer.phar 是 Compos ...

  3. 数据库——MySQL进阶

    1.索引 2.触发器 3.存储过程 4.函数 5.事务 6.视图 1.索引 索引,是数据库中专门用于帮助用户快速查询数据的一种数据结构.类似于字典中的目录,查找字典内容时可以根据目录查找到数据的存放位 ...

  4. loj2291 「THUSC 2016」补退选

    ref pkusc 快到了,做点 thusc 的题涨涨 rp-- #include <iostream> #include <cstring> #include <cst ...

  5. cf936c Lock Puzzle

    ref #include <algorithm> #include <iostream> #include <cstring> #include <cstdi ...

  6. leetcode 【 Two Sum 】python 实现

    题目: Given an array of integers, find two numbers such that they add up to a specific target number. ...

  7. MFC定时关机程序的实现2-添加启动项到注册表

    虽然上一篇实现了的定时关机,但是还不够完善,比如开机自动启动,然后按照配置的时间定时关机,并最小化到任务栏. 先来说开机启动怎么实现,开机启动实现的方法有好几种,比如直接在开始菜单启动项里添加一个程序 ...

  8. xss games20关小游戏附源代码

    1. get方式的的值直接输出来了. ?name=<script>alert(1)</script> 2. 同样没有过滤,不过需要闭合前边的双引号和>. "&g ...

  9. Mybatis通过接口的方式实现增删改查

    导入jar包 [mybatis] [oracle] 生成数据库 1.添加Mybatis的配置文件mybatis-config.xml 在src目录下创建一个mybatis-config.xml文件,如 ...

  10. 谈谈Python中元类Metaclass(一):什么是元类

    简单的讲,元类创建了Python中所有的对象. 我们说Python是一种动态语言,而动态语言和静态语言最大的不同,就是函数和类不是编译时定义的,而是运行时动态创建的. 比方说我们要定义一个HelloW ...