package Hello.lrx.nb;
import java.util.Scanner;
public class Place {
public static void main(String[] args) {
Scanner in1 = new Scanner(System.in);
int x,idy,y,z;
int n = in1.nextInt();
int[] numbers= new int[n];
for(int i=0;i<n;i++){
x= in1.nextInt();
numbers[i]=x;
}
for( y=0;y<n;y++){
idy =y;
for( z=y+1;z<n;z++){
if(numbers[idy]>numbers[z]){
idy=z;
}
}
int temp =numbers[idy];
numbers[idy]=numbers[y];
numbers[y]=temp;
}
for(int i=0;i<n;i++){
System.out.println(numbers[i]);
}
}
}
Java中的选择排序
最新推荐文章于 2024-08-19 16:01:20 发布