Темы:
Various combinatorial structures
Placements with repetitions
Given two positive integers N and K. Print all strings x1, x2, ..., xN such that xi is natural and 1 ≤ xi ≤ K.
Input
Two natural numbers N and K (N, K ≤ 6) are introduced.
Imprint
Output all required strings in random order – one per line. No string must occur more than once.
Examples
# |
Input |
Output |
1 |
2 3 |
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3 |
|