코딩코양이코리

  • 홈
  • 태그
  • 방명록

백준 문제 풀이/기타 2

1927 최소 힙 (python)

풀이import sysimport heapqinput = sys.stdin.readlinen = int(input().rstrip())heap = []for _ in range(n):    x = int(input().rstrip())    if x == 0:        if len(heap) > 0:            # 가장 작은 값 출력            m = heapq.heappop(heap)            print(m)        else:            print(0)    else:        heapq.heappush(heap, x) heap 기초 문제

백준 문제 풀이/기타 2024.07.08

1764 듣보잡 (python)

첫 번째 풀이import sysinput = sys.stdin.readlinen, m = map(int, input().split())a_lst = []b_lst = []for _ in range(n):    a = input().strip()    a_lst.append(a)for _ in range(m):    b = input().strip()    b_lst.append(b)a_lst.sort()b_lst.sort()set_a_lst = set(a_lst)set_b_lst = set(b_lst)print(len(set_a_lst.intersection(set_b_lst)))for i in set_a_lst.intersection(set_b_lst):    print(i)풀어서 정답이 나왔다.하지만..

백준 문제 풀이/기타 2024.07.08
이전
1
다음
더보기
프로필사진

코딩코양이코리

  • 분류 전체보기 (24)
    • 백준 문제 풀이 (17)
      • 스택, 큐, 덱 (1)
      • DFS, BFS (3)
      • DP (2)
      • 그리디 (1)
      • 수학 (7)
      • 기타 (2)
    • 새로 알게 된 점 (3)
    • 알고리즘 코드 (4)

Tag

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/07   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바