Sort basic exercise series and exercise Series

Source: Internet
Author: User

Sort basic exercise series and exercise Series
Basic exercise series sorting time limit: 1.0 s memory limit: 512.0 MBThe Problem description is given a series with a length of n, which is arranged in ascending order. 1 <= n <= 200 the first row of the input format is an integer n.
The second row contains n integers, which are the numbers to be sorted. The absolute value of each integer is less than 10000. The output format outputs a row, and the sorted series are output in ascending order. Sample input 5
8 3 6 4 9 sample output 3 4 6 8 9

Import java. util. Arrays;
Import java. util. collections;
Public class Main {
Public static void main (String [] args ){
Repeated scan = new partition (System. in );
Int n, arr [];
While (scan. hasNextInt ()){
N = scan. nextInt ();
Arr = new int [n];
For (int I = 0; I <n; I ++) arr [I] = scan. nextInt ();
Arrays. sort (arr );
For (int I = 0; I <n; I ++) System. out. print (arr [I] + "");
System. out. println ();
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.