[파이썬/python] 백준 1863번 스카이라인 쉬운거
·
Algorithm
import sys from collections import Counter N = int(sys.stdin.readline()) skyline = list() for i in range(N): A, B = map(int, sys.stdin.readline().split()) tup = (A, B) tup = list(tup) skyline.append(tup) count = 0 index = 1 # 사실 지금 생각해보니 튜플로 저장할 필요가 없음 # x좌표는 어차피 순서대로 입력돼서 필요 없는데 왜 저장했지 # 아무튼 바꾸기 귀찮으니까 걍 커밋함 for i in skyline: if i[1] == 0: index += 1 continue if i == skyline[N - 1]: count += 1 b..
[파이썬/python] 백준 1374번 강의실
·
Algorithm
import sys N = int(sys.stdin.readline()) lec = list() for i in range(N): num, start, finish = map(int, sys.stdin.readline().split()) lec.append([start, finish]) lec.sort() temp = [lec[0][1]] index = 1 minFinish = temp[0] while index lec[index][1]: minFinish = lec[index][1] else: temp.sort() temp[0] = lec[index][1]..
[파이썬/python] 백준 1101번 카드 정리 1
·
Algorithm
N, M = map(int, input().split()) box = list() for i in range(N): box.append(list(map(int, input().split()))) jocker = list() one = list() for b in box: already = False isOne = -1 for index in range(M): if b[index] != 0: # check non-zeros if not already: already = True isOne = index else: # two non-zeros exist if isOne != -1: jocker.append(b) # add to jocker isOne = -1 if isOne != -1: one.append(..
Sean 션
'분류 전체보기' 카테고리의 글 목록 (6 Page)