#include <stdio.h>
int N, M, arr[10], chk[10];
void output() {
for (int i = 1; i <= N; i++)
printf("%d ", arr[i]);
printf("\n");
}
void dice1(int step) {
if (step > N) {
output();
return;
}
for (int i = 1; i <= 6; i++) {
arr[step] = i;
dice1(step + 1);
}
}
void dice2(int step) {
if (step > N) {
output();
return;
}
for (int i = arr[step - 1]; i <= 6; i++) {
arr[step] = i;
dice2(step + 1);
}
}
void dice3(int step) {
if (step > N) {
output();
return;
}
for (int i = 1; i <= 6; i++) {
if (chk[i]) continue;
chk[i] = 1;
arr[step] = i;
dice3(step + 1);
chk[i] = 0;
}
}
int main() {
scanf("%d %d", &N, &M);
arr[0] = 1;
if (M == 1) dice1(1);
else if (M == 2) dice2(1);
else dice3(1);
return 0;
}
얼마
1000원