Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin ("sumbdiv.in");
- ofstream fout ("sumbdiv.out");
- int m , x , d[105] , n , st[7];
- void Back(int top)
- {
- if(top == (m + 1))
- {
- for(int i = 1 ; i <= m ; i++)
- fout << d[st[i]] << " ";
- fout << "\n";
- }
- else for(int i = 1 + st[top - 1] ; i <= n ; i++)
- {
- st[top] = i;
- Back(top + 1);
- }
- }
- int main()
- {
- fin >> x >> m;
- cout << "-1\n";
- for(int i = 1 ; i <= x ; i++)
- if(x % i == 0)
- d[++n] = i;
- sort(d + 1 , d + n + 1);
- Back(1);
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement