Topic Link:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&itemid=8&page=show_problem& problem=2457
Main topic:
given an array of age data, each group has n (0<n<=2000000) data, which requires an order to be arranged from small to large, it is important to note that the input data is more likely, so you need to use a faster IO
Case:
Sample Input 53 4 2) 1 552 3 2) 3 10Sample Output1 2 3) 4 51 2 2) 3 3
Topic Analysis:
Multiple sets of data, it is important to note that the data size is variable, you can define the array outside the function body, and then use the sort function array to arrange, in addition to pay attention to the output format of the data!
Source:
1#include <cstdio>2#include <algorithm>3 using namespacestd;4 Const intmaxn=2000000;5 intA[MAXN];//function to define an array outside the body6 intN;7 intMain ()8 {9 Ten while(SCANF ("%d", &n) &&N) One { A for(intI=0; i<n;i++) -scanf"%d", &a[i]);//Enter Age -Sort (a,a+n);//Sort theprintf"%d", a[0]); - for(intj=1; j<n;j++)//Note the space output format -printf"%d", A[j]); -printf"\ n"); + } - return 0; +}
11462-age Sort