I've been banging my head over this problem since last week, and i'm no closer to an answer than i was when i started.Let m be an integer, greater than zero but less than eleven. Numerical strings, in which each digit is greater or equal to 0 but less than m, are numbers of the number system in the base m. The numbers 10110 and 1981, for example, are numbers of the number system in the base the 10, but only the first one is a number of the number system in the base 2. The zeros at the beginning of the number are leading zeros, unless the number is 0.
Write a program that reads the integers m and n, and outputs all numbers of the number system in the base m containing n digits at the most, and without leading zeros. Each number may be output only once.
You may assume that m is greater than 0, but less than 11, and that n is greater than 0 but less than 81.
The numbers should be output on consecutive lines, one number per line.
I find myself always coming back to the idea of implementing a bidimensional array as such: nsys[n][m]
But i can't figure out the system of loops and conditions that would correctly solve this problem.
I'm hopelessly stuck. I'll keep banging my head, but i doubt i'll answer this.
I thought i'd ask for some help. Some clever hints would be better than the straight answer, as i would like to figure out as much of it by myself as i can. But i really need help.