We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
출력시에 System.out.println(x) 로 하나씩 출력하는게 아니라 StringBuilder 를 사용해서 한번에 출력하면 시간초과를 피할 수 있습니다.
public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); ArrayList<Integer> data = new ArrayList<>(); for (int i = 0; i < n; i++) { int x = Integer.parseInt(br.readLine()); data.add(x); } Collections.sort(data); StringBuilder sb = new StringBuilder(); for (int x: data) { sb.append(x).append("\n"); } System.out.println(sb); br.close(); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
출력시에 System.out.println(x) 로 하나씩 출력하는게 아니라
StringBuilder 를 사용해서 한번에 출력하면 시간초과를 피할 수 있습니다.
The text was updated successfully, but these errors were encountered: