Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1492
Problem descriptiona 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
4120
Sample output
36
The Code is as follows:
# Include <cstdio> # include <cstring> int main () {_ int64 N; _ int64 A [4] = {2, 3, 5, 7}, B [4]; while (scanf ("% i64d", & N) {memset (B, 0, sizeof (B); For (INT I = 0; I <4; I ++) {While (N % A [I] = 0) {B [I] ++; N/= A [I] ;}} _ int64 ans = (B [0] + 1) * (B [1] + 1) * (B [2] + 1) * (B [3] + 1); printf ("% i64d \ n", ANS);} return 0 ;}
HDU 1492 the number of divisors (approx.) about humble numbers (mathematical problem)