NYOJ之三个数从小到大排序

时间:2020-12-04 19:31:18

NYOJ之三个数从小到大排序

-------------------------------------------

AC代码:

 1 import java.util.Arrays;
 2 import java.util.Scanner;
 3 
 4 public class Main {
 5 
 6     public static void main(String[] args) {
 7         
 8         Scanner sc=new Scanner(System.in);
 9         
10         int x[]=new int[3];
11         for(int i=0;i<x.length;i++){
12             x[i]=sc.nextInt();
13         }
14         
15         Arrays.sort(x);
16         
17         for(int i=0;i<x.length;i++){
18             System.out.print(x[i]+" ");
19         }
20         
21     }
22     
23 }

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=41