Problem C:Integer Factorization

Time Limit:2000MS  Memory Limit:65536K
Total Submit:235 Accepted:127

Description

问题描述:
大于1 的正整数n可以分解为:n=X1*X2*…*Xm。
例如,当n=12 时,共有8 种不同的分解式:
12=12;
12=6*2;
12=4*3;
12=3*4;
12=3*2*2;
12=2*6;
12=2*3*2;
12=2*2*3。
编程任务:
对于给定的正整数n,编程计算n共有多少种不同的分解式。

Input

输入由多组测试数据组成。
每组测试数据输入第一行有1 个正整数n (1≤n≤2000000000)。

Output

对应每组输入,输出计算出的不同的分解式数。

Sample Input

12

 

 

Sample Output

8

    

     照着学长的思路,第一次亦步亦趋的写下了我的第一个记忆化搜索程序。照本人的理解,所谓记忆化搜索,就是每dfs一次,可以解出另外问题的解,而此法的优点就是每次把求得解及时记录下来,以备下次使用。

 

Integer Factorization#include <iostream>
Integer Factorization#include 
<cmath>
Integer Factorization#include 
<map>
Integer Factorization
using namespace std;
Integer Factorization
Integer Factorizationmap
<int,int>
 cnt;
Integer Factorization
Integer Factorization
int dfs(int
 n)
}

相关文章: