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. stark组件前戏(1)之项目启动前加载指定文件

    django项目启动时,可以自定义执行某个py文件,这需要在任意app的apps.py中的Config类定义ready方法,并调用.   from django.apps import AppConf ...

  2. 用描述符实现缓存功能和property实现原理

    class Lazyproperty: def __init__(self, func): self.func = func def __get__(self, instance, owner): p ...

  3. 记忆化搜索:POJ1579-Function Run Fun(最基础的记忆化搜索)

    Function Run Fun Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14815 Accepted: 7659 Des ...

  4. Median of Two Sorted Arrays LeetCode Java

    两排序好的数组,找中位数 描述There are two sorted arrays A and B of size m and n respectively. Find the median of ...

  5. MapReduce进行数据查询和实现推简单荐系统

    1  运行环境说明 1.1 硬软件环境 1.2 机器网络环境 2  书面作业1:计算员工相关 2.1 书面作业1内容 2.2  实现过程 2.2.1   准备测试数据 2.2.2   问题1:求各个部 ...

  6. 使用chrome开发程序,自动刷新开发目录

    npm i livereload -g 在开发目录下: livereload 安装这个插件:https://chrome.google.com/webstore/detail/livereload/j ...

  7. 配置网络策略中的 NAP 条件

    TechNet 库 Windows Server Windows Server 2008 R2 und Windows Server 2008 按类别提供的 Windows Server 内容 Win ...

  8. day02_04.算算多少人

    第四题 算算有多少人? 第二题的升级版,看看你能不能做出来 利用你的编程思想去看这道题目,记住不要放过题目的每一个小细节 题目:操场上100多人排队,3人一组多1人,4个一组多2人,5人一组多3人,共 ...

  9. jquery左右滑动菜单

    <div class="mini-container" style="position:relative;height:100%;"> <di ...

  10. 服务器提交了协议冲突。Section=ResponseHeader Detail=标头名称无效

    服务器提交了协议冲突.Section=ResponseHeader Detail=CR 后面必须是LF. 微软没有容忍不符合RFC 822中的httpHeader必须以CRLF结束的规定的服务器响应所 ...