标签:
package excel; import java.util.Scanner; public class doExcel { public static void main(String args[]){ Scanner input=new Scanner(System.in); int n; System.out.print("input n:"); n=input.nextInt(); int num[]=new int[n]; for(int i=0;i<n;i++){ num[i]=input.nextInt(); } int[] position=new int[n]; for(int i=0;i<n;i++){ int k=0; for(int j=0;j<n;j++){ if(i!=j){ if(num[i]>num[j]){ k++; } if(num[i]==num[j]&&i<j){ } if(num[i]==num[j]&&i>j){ k++; } }else{ } } position[k]=num[i]; } for(int i=0;i<n;i++){ System.out.print(position[i]+" "); } } }
标签:
原文地址:http://www.cnblogs.com/wpzy2311/p/5021173.html