Pagini recente » Cod sursa (job #569777) | Cod sursa (job #3165253) | Cod sursa (job #2291805) | Cod sursa (job #1767773) | Cod sursa (job #2614806)
#include <bits/stdc++.h>
#define DAU ios_base::sync_with_stdio(false); fin.tie(0); fout.tie(0);
#define PLEC fin.close(); fout.close(); return 0;
using namespace std;
const string problem("combinari");
ifstream fin(problem + ".in");
ofstream fout(problem + ".out");
int n, p, st[20];
inline void Back(int k) {
if (k == p + 1) {
for (int i = 1; i <= p; ++i)
fout << st[i] << ' ';
fout << '\n';
return;
}
for (int i = st[k-1] + 1; i <= n - p + k; ++i)
st[k] = i, Back(k + 1);
}
int main() {
DAU
fin >> n >> p;
Back(1);
PLEC
}