Topic 1190: Sorting large integers

Source: Internet
Author: User

Title Description:

Sorts the number of n lengths up to 1000.

Input:

Enter the first behavior of an integer N, (1<=n<=100).
The next n rows have a number for each row, and the length of the number is 1<=len<=1000.
Each count is a positive number and is guaranteed to contain no prefix zeros.

Output:

There may be more than one set of test data, for each set of data, the number of n will be given to order from small to large, output sorted results, each of the number of rows.

Sample input:
311111111111111111111111111111222222222222222222222222222222222233333333
Sample output:
33333333111111111111111111111111111112222222222222222222222222222222222

1 ImportJava.math.BigInteger;2 Importjava.util.Arrays;3 ImportJava.util.Scanner;4  5  Public classmain{6      Public Static voidMain (String[]args) {7Scanner in=NewScanner (system.in);8      while(In.hasnext ()) {9         intn=in.nextint ();Ten in.nextline (); OneBiginteger[] X=NewBiginteger[n]; A          for(inti=0;i<n;i++){ -String line=in.nextline (); -x[i]=NewBigInteger (string.valueof (line)); the         } - arrays.sort (x); -          for(inti=0;i<n;i++){ - System.out.println (X[i]); +         } -     } +     } A  } at   - /************************************************************** - problem:1190 - user:0000h - Language:java - result:accepted in time:520 Ms - memory:40476 KB to ****************************************************************/

Topic 1190: Sorting large integers

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.