class Play3 {
public static void main(String[] args) {
int[] a ={1,5,9,23,76,37,45,28,19,26,89,100,24};
int[][] ar = new int[14][];
ar[0]= a;
int[] y =new int[13];
for (int i =0;i<=12 ;i++ ) {
y[i] = ar[i][(int)(ar[i].length * Math.random())];
ar[i+1]=delete(ar[i],y[i]);
}
for (int i =0;i<=12 ;i++ ) {
System.out.print(y[i]+" ");
}
}
public static int[] delete(int[] arr, int c){
int i =0;
for (i =0;i<arr.length ;i++ ) {
if (arr[i]==c) {
break;
}
}
int[] a= new int[arr.length-1];
for (int j =0;j<arr.length-1 ;j++ ) {
if (j<i) {
a[j]=arr[j];
}
if (j>=i) {
a[j]=arr[j+1];
}
}
return a;
}
}
|
|