Skip to content

Instantly share code, notes, and snippets.

@mym0404
Created May 31, 2022 03:50
Show Gist options
  • Save mym0404/b6d1aad8e4f549066e43604fdc711a4a to your computer and use it in GitHub Desktop.
Save mym0404/b6d1aad8e4f549066e43604fdc711a4a to your computer and use it in GitHub Desktop.
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
ArrayList<Integer> arr = new ArrayList<>();
for(int i = 0; i < n; i++) {
int k = Integer.parseInt(br.readLine());
arr.add(k);
}
Collections.sort(arr);
for(int i = 0; i < n; i++)
System.out.println(arr.get(i));
bw.flush();
bw.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment