[백준] 📂. (15652번) N과 M (4)
🗒️ 15652번) N과 M (4)
#include <iostream>
using namespace std;
int sel[8];
int N, M;
void Sequence(int start, int count)
{
if (count == M)
{
for (int i = 0; i < M; i++)
cout << sel[i] << ' ';
cout << '\n';
return;
}
for (int i = start; i < N; i++)
{
sel[count] = i + 1;
Sequence(i, count + 1);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N >> M;
Sequence(0, 0);
return 0;
}
댓글남기기