글 작성 제목과 내용을 간결하게 정리해 주세요. 제목 내용 <h2>파이썬</h2><pre><code class="language-python">import sys input = sys.stdin.readline times = [] result = 0 for i in range(int(input())): times.append(tuple(map(int, input().split()))) times = sorted(sorted(times, key=lambda x:x[0]), key=lambda x:x[1]) temp = () for i in range(0, len(times)): if(i == 0) : temp = times[0] result += 1 continue if times[i][0] == times[i][1] or times[i][0] >= temp[1] : temp = times[i] result += 1 print(result) </code></pre><h2>자바</h2><pre><code class="language-java">import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; public class Main { public static void main(String[] args) throws IOException { new Main().solve(); } public void solve() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); ArrayList<ConfTimeObj> list = new ArrayList<>(); int result = 0; // 입력 받은거 리스트에 ConfTimeObj 객체로 추가 int n = Integer.parseInt(br.readLine()); for (int i = 0; i < n; i++) { String[] times = br.readLine().split(" "); // ConfTimeObj 객체에 생성 및 저장 list.add(new ConfTimeObj(Integer.parseInt(times[0]), Integer.parseInt(times[1]))); } // 끝시간 정렬 시작시간 정렬 List<ConfTimeObj> sortedList = list.stream() .sorted(Comparator.comparingInt(ConfTimeObj::getEnd).thenComparing(ConfTimeObj::getStart)) .collect(Collectors.toList()); // 개수 세기 ConfTimeObj temp = null; for (int i = 0; i < sortedList.size(); i++) { if(i == 0) { temp = sortedList.get(i); result++; continue; } if (sortedList.get(i).start == sortedList.get(i).end || sortedList.get(i).start >= temp.end) { temp = sortedList.get(i); result++; } } System.out.println(result); } } class ConfTimeObj { public int start; public int end; public ConfTimeObj(int start, int end) { this.start = start; this.end = end; } public int getStart() { return this.start; } public int getEnd() { return this.end; } } </code></pre> 글 종류 이론 정리 알고리즘 이론에 대한 정리글입니다. 문제 풀이 알고리즘 문제 풀이입니다. 알고리즘 분류 수정 취소