#include <iostream> #include <cmath> using namespace std; int N,M; //#balls, #draw int main () { cin >> N >> M; int size=(int)pow((float)N,(float)M); for (int i=0;i<size;i++){ int a=i; for (int j=0;j<M;j++){ cout << a%N << ' '; a = a/N; } cout << endl; } }
3 2
0 0 1 0 2 0 0 1 1 1 2 1 0 2 1 2 2 2
沒有留言:
張貼留言