본문 바로가기
백준/20001 - 25000

[백준] 23235번 : The Fastest Sorting Algorithm In The World(JAVA)

by lms0806 2021. 10. 12.
728x90
반응형

https://www.acmicpc.net/problem/23235

 

23235번: The Fastest Sorting Algorithm In The World

It is common to compare sorting algorithms based on their asymptotic speeds. Some slower algorithms like selection sort take O(N2) time to sort N items, while comparison-based sorts like merge sort can go no faster than O(N log(N)) time, under reasonable a

www.acmicpc.net

풀이

sort를 한후 Case n: Sorting... done!을 출력하면 되는 문제이다.

그러나 sort를 직접 할 필요 없이 sort를 했다는 가정하에 출력만 하면됩니다.

sort한 후의 결과를 직접적으로 보여지지 않으니깐 말이죠

 

소스코드

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 
		
		StringBuilder sb = new StringBuilder();
		int count = 1;
		while(true) {
			String s = br.readLine();
			
			if(s.equals("0")) {
				break;
			}
			sb.append("Case ").append(count).append(": Sorting... done!").append("\n");
			count++;
		}
		System.out.print(sb);
	}
}
728x90
반응형

댓글