import java.io.BufferedReader; import java.io.FileReader; import java.io.File; import java.lang.Double; import java.lang.Integer; import java.lang.Math; public class homogeneous{ public static void main(String[] args){ try{ BufferedReader read= new BufferedReader(new FileReader(new File("homogeneous.in"))); boolean done= false; //abgebrochen? while(!done) done=read(read); } catch (Exception e){ System.out.println("error1"); } } public static boolean read(BufferedReader read){ String line; int[][] array=null; int size=0; try{ if((line=read.readLine())!=null){ size= Integer.parseInt(line); array= new int[size][size]; //Zeile for(int row=0; row 1,2 / 2,1 3x3 -> 1,2,3 / 1,3,2 / 2,1,3 / 2,3,1 / 3,1,2 / 3,2,1 4x4 -> 1,2,3,4 1,2,4,3 1,3,2,4 1,3,4,2 1,4,2,3 1,4,3,2 ... */ //Zuerst alle permutationen, anzahl size*size int[][] perm= new int[(int)java.lang.Math.pow(size,size)][size]; //Index der Spalte for(int sp=0; sp0){ //System.out.println("Zeile: "+ze); perm[ze][sp]= zahl; c--; if(c==0){ zahl++; if(zahl==size) zahl=0; c=x; } } } } //markiere dependent //gehe durch alle perms for(int i=0; i