演算法訓練 排序

acDream_發表於2019-01-06

Problem:

AcCode:

import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[] nums = new int[3];
		for (int i = 0; i < nums.length; i++) {
			nums[i] = in.nextInt();
		}
		Arrays.sort(nums);
		for (int i = nums.length-1; i >0; i--) {
			System.out.print(nums[i]+" ");
		}
		System.out.println(nums[0]);
	}
}

 

相關文章