Hardcore
23-10-2010, 12:54
Можеье объеснить в чем суть задачи? я нечего не понял.
Given two positive integers n and k. Your task is to output all Required to withdraw all of the chain x1, x2, ..., xN such that xi - natural and 1<=xi<=k.
Note. Use recursion for solving this problem.
Input:
Only one line that contains n and k (1 <= n,k <= 6).
Output:
Your output have to be
Examples:
Input 1:
2 3
Output 1:
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
Input 2:
3 3
Output 2:
1 1 1
1 1 2
1 1 3
1 2 1
1 2 2
1 2 3
1 3 1
1 3 2
1 3 3
2 1 1
2 1 2
2 1 3
2 2 1
2 2 2
2 2 3
2 3 1
2 3 2
2 3 3
3 1 1
3 1 2
3 1 3
3 2 1
3 2 2
3 2 3
3 3 1
3 3 2
3 3 3
Given two positive integers n and k. Your task is to output all Required to withdraw all of the chain x1, x2, ..., xN such that xi - natural and 1<=xi<=k.
Note. Use recursion for solving this problem.
Input:
Only one line that contains n and k (1 <= n,k <= 6).
Output:
Your output have to be
Examples:
Input 1:
2 3
Output 1:
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
Input 2:
3 3
Output 2:
1 1 1
1 1 2
1 1 3
1 2 1
1 2 2
1 2 3
1 3 1
1 3 2
1 3 3
2 1 1
2 1 2
2 1 3
2 2 1
2 2 2
2 2 3
2 3 1
2 3 2
2 3 3
3 1 1
3 1 2
3 1 3
3 2 1
3 2 2
3 2 3
3 3 1
3 3 2
3 3 3