-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInteger Factorization.cpp
More file actions
72 lines (72 loc) · 1.54 KB
/
Copy pathInteger Factorization.cpp
File metadata and controls
72 lines (72 loc) · 1.54 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//#include<stdio.h>
//#include<vector>
//#include<map>
//#include<queue>
//#include<cmath>
//#pragma warning(disable:4996)
////´íÒ»¸ö
//using namespace std;
//double cur_sum = 0;
//int cur_factorsSum = 0;
//vector<int> *cur_ans=new vector<int>;
//map<int, int> factorsSum_of_ans;
//int N, K, P;
//class cmp
//{
//public:
// bool operator()(const vector<int>* a,const vector<int>* b)
// {
// int fa = factorsSum_of_ans[reinterpret_cast<long>(a)];
// int fb = factorsSum_of_ans[reinterpret_cast<long>(b)];
// return fa < fb;
// }
//};
//priority_queue<vector<int>*, vector<vector<int>* >, cmp> ans;
//void dfs(int k=0,int last=N)
//{
// if (k == K)
// {
// if (cur_sum == (double)N)
// {
// factorsSum_of_ans[reinterpret_cast<long>(cur_ans)] = cur_factorsSum;
// ans.push(cur_ans);
// vector<int>* new_vector = new vector<int>;
// new_vector->insert(new_vector->end(), cur_ans->begin(), cur_ans->end());
// cur_ans = new_vector;
// }
// return;
// }
// for (int i = 1; i <=last; i++)
// {
// double a = pow(i,P);
// if (a + cur_sum > (double)N)break;
// cur_sum += a;
// cur_factorsSum += i;
// cur_ans->push_back(i);
// dfs(k+1,i);
// cur_ans->pop_back();
// cur_factorsSum -= i;
// cur_sum -=a;
// }
//}
//int main()
//{
// scanf("%d%d%d", &N, &K, &P);
// dfs();
// if (ans.empty())
// {
// printf("Impossible");
// }
// else
// {
// cur_ans = ans.top();
// printf("%d = ", N);
// for (int i = 0; i < cur_ans->size(); i++)
// {
// printf("%d^%d", (*cur_ans)[i],P);
// if (i != cur_ans->size() - 1)printf(" + ");
// }
// }
//
// return 0;
//}