zoukankan      html  css  js  c++  java
  • HDUOJ---The number of divisors(约数) about Humble Numbers

    The number of divisors(约数) about Humble Numbers

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

    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
     
    Source
    Recommend
    LL
    分解质因数
     1 //http://acm.hdu.edu.cn/showproblem.php?pid=1492
     2 #include<iostream>
     3 #include<cstdio>
     4 using namespace std;
     5 int main()
     6 {
     7     _int64 i,n,c1,c2,c3,c4;
     8     
     9     while(scanf("%I64d",&n),n)
    10     { 
    11         for(c1=1,i=n;i%2==0&&i!=0;i/=2) 
    12                    c1++;
    13         for(c2=1,i=n;i%3==0&&i!=0;i/=3)
    14                     c2++;
    15         for(c3=1,i=n;i%5==0&&i!=0;i/=5) 
    16                     c3++;
    17          for(c4=1,i=n;i%7==0&&i!=0;i/=7) 
    18                     c4++;
    19         printf("%I64d
    ",c1*c2*c3*c4);
    20     }
    21 return 0;
    22 }
    View Code
  • 相关阅读:
    js上拉加载下拉刷新
    CSRF
    Linux 常用命令
    汇编语言:了解寄存器与内存模型
    Node 的fs模块
    pdf转为html查看pdf.js
    centOs升级
    H5新特性监听手机的返回键
    gsap
    使用 iframe + postMessage 实现跨域通信
  • 原文地址:https://www.cnblogs.com/gongxijun/p/3242749.html
Copyright © 2011-2022 走看看