diff --git "a/cmkim/BaekJoon/\353\260\261\354\244\200_17179.py" "b/cmkim/BaekJoon/\353\260\261\354\244\200_17179.py" new file mode 100644 index 0000000..fa0da0c --- /dev/null +++ "b/cmkim/BaekJoon/\353\260\261\354\244\200_17179.py" @@ -0,0 +1,45 @@ +n, m, l = map(int, input().split()) + +cut = [] +arr = [] +for i in range(m): # 자르는 위치 + cut.append(int(input())) +#print(cut) + +for i in range(n): # 자르는 횟수 + arr.append(int(input())) + +def calculate(mid, count): # 가장 작은 조각의 길이 > mid 일때 횟수를 세서 count 값이 만들어지면 성공 + prev = 0 + for i in range(m): + if cut[i] - prev >= mid: + count -= 1 + prev = cut[i] + if count == 0: + break + + + if count == 0 and l - prev >= mid: + return True + else: + return False + +for i in range(n): + piece = arr[i] + left = 0 + right = l + + while left + 1 < right: + mid = (left + right) // 2 + if calculate(mid, piece): + left = mid + else: + right = mid + + print(left) + + + + + + diff --git "a/cmkim/BaekJoon/\353\260\261\354\244\200_4386.py" "b/cmkim/BaekJoon/\353\260\261\354\244\200_4386.py" new file mode 100644 index 0000000..967ee88 --- /dev/null +++ "b/cmkim/BaekJoon/\353\260\261\354\244\200_4386.py" @@ -0,0 +1,48 @@ +import sys, math, heapq +n = int(input()) + +arr = [] +connected = [] +sum = 0 +cost = 1e9 + +def dist(x1, y1, x2, y2): + return math.sqrt((x1 - x2)**2 + (y1 - y2)**2) + +for i in range(n): + x, y = map(float, input().split()) + arr.append((x, y)) + +q = [] +connected.append(0) +for i in range(1, n): + heapq.heappush(q, (dist(arr[0][0], arr[0][1], arr[i][0], arr[i][1]), i)) + +# print(connected) +# print(q) + +while n != len(connected): + value, node = heapq.heappop(q) + while node in connected: + value, node = heapq.heappop(q) + + sum += value + connected.append(node) + + for i in range(n): + if i not in connected: + heapq.heappush(q, (dist(arr[node][0], arr[node][1], arr[i][0], arr[i][1]), i)) + +print("%.2f"%(sum)) + + + + + + + + + + + + diff --git "a/cmkim/\354\235\264\352\262\203\354\235\264 \354\267\250\354\227\205\354\235\204 \354\234\204\355\225\234 \354\275\224\353\224\251 \355\205\214\354\212\244\355\212\270\353\213\244/\354\227\260\352\265\254\354\206\214_341p.py" "b/cmkim/\354\235\264\352\262\203\354\235\264 \354\267\250\354\227\205\354\235\204 \354\234\204\355\225\234 \354\275\224\353\224\251 \355\205\214\354\212\244\355\212\270\353\213\244/\354\227\260\352\265\254\354\206\214_341p.py" new file mode 100644 index 0000000..8b8b136 --- /dev/null +++ "b/cmkim/\354\235\264\352\262\203\354\235\264 \354\267\250\354\227\205\354\235\204 \354\234\204\355\225\234 \354\275\224\353\224\251 \355\205\214\354\212\244\355\212\270\353\213\244/\354\227\260\352\265\254\354\206\214_341p.py" @@ -0,0 +1,61 @@ +n, m = map(int, input().split()) + +arr = [] +temp = [[0] * m for _ in range(n)] +result = 0 + +dx = [-1, 1, 0, 0] +dy = [0, 0, -1, 1] + +for i in range(n): + arr.append(list(map(int, input().split()))) + + + +def dfs(count): + global result + + if count == 3: + for i in range(n): + for j in range(m): + temp[i][j] = arr[i][j] + + for i in range(n): + for j in range(m): + if temp[i][j] == 2: + virus(i, j) + + result = max(result, get_score()) + return + + for i in range(n): + for j in range(m): + if arr[i][j] == 0: + arr[i][j] = 1 + count += 1 + dfs(count) + arr[i][j] = 0 + count -= 1 + + +def virus(x, y): + for i in range(4): + nx = x + dx[i] + ny = y + dy[i] + if 0 <= nx < n and 0 <= ny < m: + if temp[nx][ny] == 0: + temp[nx][ny] = 2 + virus(nx, ny) + + +def get_score(): + score = 0 + for i in range(n): + for j in range(m): + if temp[i][j] == 0: + score += 1 + return score + + +dfs(0) +print(result) diff --git "a/cmkim/\354\235\264\352\262\203\354\235\264 \354\267\250\354\227\205\354\235\204 \354\234\204\355\225\234 \354\275\224\353\224\251 \355\205\214\354\212\244\355\212\270\353\213\244/\355\212\271\354\240\225 \352\261\260\353\246\254\354\235\230 \353\217\204\354\213\234 \354\260\276\352\270\260_339p.py" "b/cmkim/\354\235\264\352\262\203\354\235\264 \354\267\250\354\227\205\354\235\204 \354\234\204\355\225\234 \354\275\224\353\224\251 \355\205\214\354\212\244\355\212\270\353\213\244/\355\212\271\354\240\225 \352\261\260\353\246\254\354\235\230 \353\217\204\354\213\234 \354\260\276\352\270\260_339p.py" new file mode 100644 index 0000000..e69de29