PDA

Показать полную графическую версию : Htr


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

lxa85
23-10-2010, 17:57
Hardcore, просят решить Комбинаторную (http://ru.wikipedia.org/wiki/%D0%9A%D0%BE%D0%BC%D0%B1%D0%B8%D0%BD%D0%B0%D1%82%D0%BE%D1%80%D0%B8%D0%BA%D0%B0) задачу.




© OSzone.net 2001-2012