-
2606 바이러스코테 대비 python/백준 2022. 9. 28. 15:10
https://www.acmicpc.net/problem/2606
n = int(input()) m = int(input()) graph = [[ ]for _ in range(n+1)] for _ in range(m): a, b = map(int, input().split()) graph[a].append(b) graph[b].append(a) visited = [0]*(n+1) def dfs (graph,v,visited): visited[v]=1 for i in graph[v]: if visited[i]==0: dfs(graph,i,visited) return True dfs(graph,1,visited) print(sum(visited)-1)
어려어~~~~~ 😭😭😭😭😭😭😭😭😭
'코테 대비 python > 백준' 카테고리의 다른 글
2667 단지번호 붙히기 (0) 2022.11.03 2178_미로탐색 (0) 2022.10.25 8979 올림픽 (2) 2022.09.16 5635 생일 (0) 2022.09.08 11723 집합 (0) 2022.08.30