import java.util.Scanner;
public class Main {
static int n, m;
static int arr[] = new int[101];
static StringBuilder sb;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
sb = new StringBuilder();
n = scan.nextInt();
m = scan.nextInt();
dice(1, 0);
System.out.print(sb);
}
private static void dice(int level, int sum) {
// TODO Auto-generated method stub
int i;
if (level > n) {
if (sum == m) {
output();
}
return;
}
else {
for (i = 1; i <= 6; i++) {
arr[level] = i;
dice(level + 1, sum + i);
}
}
}
private static void output() {
// TODO Auto-generated method stub
int i;
String st = "";
for (i = 1; i <= n; i++) {
st = st + arr[i] + " ";
}
sb.append(st + "\n");
}
}
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=458&sca=2080
'정올문제소스코드' 카테고리의 다른 글
1021 : 장난감조립 (0) | 2021.12.05 |
---|---|
1459 : 숫자고르기 (0) | 2021.12.05 |
1169 : 주사위 던지기1 (0) | 2021.12.05 |
1161 : 하노이1 (0) | 2021.12.05 |
1309 : 팩토리얼 (0) | 2021.12.05 |