-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchaifen.cpp
More file actions
52 lines (44 loc) · 956 Bytes
/
Copy pathchaifen.cpp
File metadata and controls
52 lines (44 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*************************************************************************
> File Name: chaifen.cpp
> Author: dulun
> Mail: dulun@xiyoulinux.org
> Created Time: 2016年03月30日 星期三 13时14分27秒
************************************************************************/
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define LL long long
using namespace std;
const int N = 50086;
int sum[N];
int a[N];
int n;
int ans = 0;
void dfs(int cur, int k)
{
++ans;
for(int i = 0; i < cur; i++)
{
printf("%d * ", a[i]);
}
printf("%d = %d\n", k, n);
for(int i = 2; i < k; i++)
{
if( k % i == 0 )
{
a[cur] = i;
dfs(cur+1, k / i);
}
}
}
int main()
{
for(int i = 0; i <= N; i++) sum[i] = 1;
cin>>n;
dfs(0, n);
//printf("%d * 1 = %d\n", n, n);
printf("total = %d\n", ans);
return 0;
}