>>955
こういう解釈でいいのかな
ループがふたつになるかな

a=new int[n];
for(i=0;i<m^n;i++){
 for(j=0;j<n;j++){
  a[j]=i%m;
  i/=m;
 }
 function(a,n);
}
delete[] a;