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