ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 2075 N번째 큰 수
    카테고리 없음 2023. 2. 18. 00:26
    # BOJ_S2_2075_N번째 큰 수[2023-02-17] </br>
    문제 : https://www.acmicpc.net/problem/2075
    
    <접근법>
    ```
    0. 원의 최대 최소 체크
    1. 인덱스 부여, 최소값인지 최대값인지 부여
    2. 같으면 끝, 스택에 있는 인덱스 다르면 끝
    3. import sys
    ```
    
    ```python
    
    
    import heapq
    n= int(input())
    #heap만들고
    #
    heap=[]
    for _ in range(n):
        nums = map(int,input().split())
        
        for num in nums:
            if len(heap) < n:
                heapq.heappush(heap,num)
                
            else:
                if heap[0] < num:
                    heapq.heappop(heap)
                    heapq.heappush(heap,num)
                    
    print(heap[0])     
    ```
Designed by Tistory.