diff --git a/wkdghdwns199/README.md b/wkdghdwns199/README.md index 60327f7..10a813b 100644 --- a/wkdghdwns199/README.md +++ b/wkdghdwns199/README.md @@ -17,4 +17,5 @@ | 13차시 | 2024.03.09 | DP | 정수 삼각형 | 2024.03.09 | | 14차시 | 2024.03.13 | 집합과 맵 | 영단어 암기는 괴로워 | 2024.03.13 | | 15차시 | 2024.03.20 | 우선순위 큐 | 절댓값 힙 | 2024.03.20 | +| 16차시 | 2024.03.23 | 조합론 | 이항 계수 1 | 2024.03.23 | diff --git "a/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-1753.py" "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-1753.py" new file mode 100644 index 0000000..9fd3d4e --- /dev/null +++ "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-1753.py" @@ -0,0 +1,35 @@ +import sys +from heapq import * + +input=sys.stdin.readline + +vertex, edge = map(int, input().split()) +start_vertex = int(input()) +graph = {v : [] for v in range(1,vertex+1)} +for _ in range(edge) : + start, end, weight = map(int, input().split()) + graph[start].append((end, weight)) + +heap = [] +result = [int(1e9)] * (vertex+1) +result[start_vertex] = 0 +heappush(heap, (start_vertex,0)) + +while heap : + + current_node, current_weight = heappop(heap) + if result[current_node] < current_weight : + continue + for node, weight in graph[current_node]: + distance = current_weight + weight + if distance < result[node]: + result[node] = distance + heappush(heap, (node, distance)) + +for i in range(1,vertex+1): + if result[i] == int(1e9): + print('INF') + else : + print(result[i]) + + diff --git "a/wkdghdwns199/\354\241\260\355\225\251\353\241\240/ACM-11050.py" "b/wkdghdwns199/\354\241\260\355\225\251\353\241\240/ACM-11050.py" new file mode 100644 index 0000000..6361451 --- /dev/null +++ "b/wkdghdwns199/\354\241\260\355\225\251\353\241\240/ACM-11050.py" @@ -0,0 +1,4 @@ +import sys, math +input = sys.stdin.readline +N,K = map(int, input().split()) +print(math.factorial(N) // (math.factorial(K) * math.factorial(N-K))) \ No newline at end of file