Skip to content

Commit

Permalink
Merge pull request #65 from AlgoLeadMe/16-wkdghdwns199
Browse files Browse the repository at this point in the history
16-wkdghdwns199
  • Loading branch information
wkdghdwns199 authored Mar 27, 2024
2 parents 18146fb + eb181c3 commit b7f3145
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions wkdghdwns199/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
| 13차시 | 2024.03.09 | DP | <a href="https://www.acmicpc.net/problem/1932">정수 삼각형</a> | <a href="">2024.03.09</a> |
| 14차시 | 2024.03.13 | 집합과 맵 | <a href="https://www.acmicpc.net/problem/20920">영단어 암기는 괴로워</a> | <a href="">2024.03.13</a> |
| 15차시 | 2024.03.20 | 우선순위 큐 | <a href="https://www.acmicpc.net/problem/11286">절댓값 힙</a> | <a href="">2024.03.20</a> |
| 16차시 | 2024.03.23 | 조합론 | <a href="https://www.acmicpc.net/problem/11050">이항 계수 1 </a> | <a href="">2024.03.23</a> |

35 changes: 35 additions & 0 deletions wkdghdwns199/리뷰풀이/ACM-1753.py
Original file line number Diff line number Diff line change
@@ -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])


4 changes: 4 additions & 0 deletions wkdghdwns199/조합론/ACM-11050.py
Original file line number Diff line number Diff line change
@@ -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)))

0 comments on commit b7f3145

Please sign in to comment.