A secret-related unit has issued some kind of bill and has to withdraw it at the end of the year.
Each ticket has a unique ID number. The ID number of all bills is continuous throughout the year, but the starting digit of the ID is randomly selected.
Because the staff negligence, in the entry ID number of a mistake occurred, resulting in a certain ID number, another ID number.
Your task is to programmatically identify the ID of the broken number and the ID of the heavy number.
Suppose the broken number cannot occur in the largest and most small.
Requires that the program first enter an integer N (n<100) to represent the number of subsequent rows of data.
Then read n rows of data.
The length of each row of data, is separated by a number of (no more than 100) positive integers (not greater than 100000)
Each integer represents an ID number.
Requires that the program output 1 lines, with two integers m n, separated by a space.
where m represents the Id,n ID of the number of broken numbers
Please output strictly according to the requirements, do not superfluous print similar: "Please enter ..." Superfluous content.
All the code is placed in the same source file, after debugging, the copy is submitted to the source.
Note: Do not use package statements. Do not use jdk1.6 and the above version of the features.
Note: The name of the main class must be: main, otherwise it will be handled in an invalid code.
[Java] View plain copy print? import java.util.scanner; class main { public static void sort (int num[], int n) { for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (Num[i] > num[j]) { int tmp = num[i]; num[i] = num[j]; num[j] = tmp; } } } } public static void main (String[] args) { Scanner Sc = new scanner (system.in); int n = sc.nextint (); sc.nextline (); int ID[] = new int[1000]; &NBSP;&NBsp; int posinid = 0; for (int i = 0; i < n; i++) { string str = sc.nextline (); string tmp[] = str.split (" "); for (int j = 0; j < tmp.length; j++) { id[posinid++] = integer.valueof (Tmp[j]); } } &nBsp; sort (Id, posinid); // for (int i = 0; i < posinid; i++) { // system.out.print (id[i] + " ");// DEBUG: print out // }
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.