k-numbers
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
For the given natural numbers n and k (2 ≤ k ≤ 10), your task is to generate and print all sequences of length n using the characters 0 through k-1, in lexicographical order.
Input
The input consists of two numbers: n and k.
Output
Print each sequence on a separate line. Ensure that each sequence ends with a newline character, and the numbers within each sequence are separated by a single space.
Examples
Input #1
Answer #1
Submissions 209
Acceptance rate 54%