[TIL] C์ธ์ด ๊ณต๋ถํ๊ธฐ
1. ์ฝ๋ refactoring 1. 12891๋ฒ - DNA ๋น๋ฐ๋ฒํธ import sys s, p = map(int, sys.stdin.readline().split()) dna = list(sys.stdin.readline().strip()) # A, C, G, T esssential = list(map(int, sys.stdin.readline().split())) def remove(st) : global a, c, g, t if dna[st] == 'A' : a -= 1 elif dna[st] == 'C' : c -= 1 elif dna[st] == 'G' : g -= 1 elif dna[st] == 'T' : t -= 1 return 0 def add(e) : global a, c, g, t i..
2023. 5. 4.
[TIL] Algorithm - ์์ ์ ๋ ฌ + ํ๋ก์ด๋-์์
1. ๊ทธ๋ํ ๋ฌธ์ ํ์ด 1. 2573๋ฒ - ๋น์ฐ โถ BFS๋ฅผ ์ด์ฉํ ํ์ด import sys from collections import deque N, M = map(int, sys.stdin.readline().split()) iceberg = [list(map(int, sys.stdin.readline().split())) for _ in range(N)] dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] # ๋น์ฐ ๋
น์ด๋ ํจ์ def melting() : change = [] for i in range(1, N-1) : for j in range(1, M-1) : if iceberg[i][j] != 0 : sea = 0 # ํ์ฌ ์์น์์ 0๊ณผ ๋ง๋ฟ์ ์๋ ๊ฐ์ for k in ran..
2023. 4. 25.