import java.util.*;
import java.io.*;
public class Main {
static int N = 1000;
static int num[] = new int[N];
public static void main(String[] args) throws IOException{
Reader sc = new Reader();
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
// Scanner会超时,System.out.print会超时
int n = sc.nextInt();
int m = sc.nextInt();
for(int i = 0; i < m; i ++ ) {
int a = sc.nextInt();
num[a] ++ ;
}
for(int i = 1; i <= n; i ++ )
for(int j = 1; j <= num[i]; j ++ )
bw.write(i + " ");
bw.flush();
}
static class Reader {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StreamTokenizer st = new StreamTokenizer(br);
public void token() {
try {
st.nextToken();
} catch (IOException e) {}
}
public int nextInt() {
token();
return (int)st.nval;
}
}
}
Java P1271 选举学生会
最新推荐文章于 2022-12-18 22:30:51 发布